Store property coming from a json array
I know there are several alternatives, but I would like to find the easiest & simpler ones to store data coming in Json format from post requests and also allowing me to do SQL queries.
I want to have a property called favouriteColors. I want to store a few colors, and I want to be able to do queries to get top favorite colors, etc... so not handling the list of colors as just a fixed string or fixed object.
If I want to store this information, I have several alternatives, like %DynamicArray, list of %String o maybe just %String, but I want to find the best way to store the property in a way that I can do SQL queries like
select COUNT(colors %FOREACH FavoriteColors) from Table
And an easy way to get the object from HTTP:
FavouriteColors = ["green","yellow","blue"]
and save it.
My initial idea is
FavouriteColors as list of %String
But then, the way to save from JSON received via POST doesn't like me. I did something like
d ##class(%ZEN.Auxiliary.jsonProvider).%ConvertJSONToObject(valueRecived.%ToJSON(),,.list) Set table.FavouriteColors = list
This one doesn't like me that much as I am using %ZEN.Auxiliary.