I’m trying to move from a manually created system over to strapi and so far i’m loving it. One thing I can’t seem to figure out though are lists/arrays of strings/numbers. I was able to create a component that had a single string in it, and then I used that component in a collection (as repeatable). That allowed me to add a list/array of those strings to a collection. The api response with that setup is quite a bit more verbose than it needs to be. For example, let’s say I want to create a playlist of vimeo IDs that is stored in an object as strings. In my current hand-coded json, it looks like this:
Is there any way to create a simple list of strings/numbers like that first example (without using the JSON collection type, I want the people who need to enter this data to not have to know JSON formatting)? I could re-adjust all of my code to parse that new format, but I prefer the cleaner/less data intensive way that it looks currently.
I see not really a problem in the current solution.
Another solution could be:
You could create a entity strings with a addString-string-Attribute and a collectionOfStrings-text-Attribute.
With beforeCreate- & beforeUpdate-Lifecycle Methods you add the value of addString to collectionOfStrings and clear addString after that.
before storing do JSON. stringify, when you get a response then you can use JSON parser to get it in the correct format. JSON was introduced in es6. you can explore more