My mobile app creates a dictionary that is an array of dictionaries describing objects. Each object includes a picture (300x260, not huge). When I perform a GenerateJSON on the array of dictionaries I get a crash. If I don’t include the picture in the dictionary for each object everything works fine. Dictionary values are Variants, and in the docs I don’t see any mention of Picture in the description of Variant.
So is the problem I’m having that you can’t add a Picture to a Dictionary? Or is something else going on?
The dictionary can store a picture.
But it can’t package it for an array.
So you may need to do GetData on the picture, pass it through EncodeBase64 and store that in the dictionary to go in the JSON.
Good discussion. Thanks to all. I’m creating the JSON to save for when the app is relaunched. Since I’m saving all the properties that I use to draw the picture in the first place, I’ll just redraw the picture when I reload each object.
It’s not difficult to convert pictures to strings and back again, if that helps. RS used to come with examples, not sure if Xojo still does. MBS also has dedicated functions for it if I’m not mistaken.