❔ Adding logic into a JSON serializer
Hey everyone! I need to add logic into a json object, but I can't add any code in there or else it'll break. Here is what I mean: If I have a
Dictionary
named Icons, I need to say foreach item selected from the filepicker, create a new keypair in the Dictionary
. Basically, the user selects a few .png files, the code needs to copy them to a folder and add those names to the dictionary. Here is my current code that is a static dictionary:
5 Replies
you could create the Dictionary before that and use that dictionary for the Icons or you can add a loop after assigning the Dictionary and add items to
Oh okay, so then just assign the icons object to the dictionary?
But create the dictionary and add content pre serialization
Yes
Adding content after it being serialized is quite hard
Youll have to deserialize it, add it and then serialize it again
So if you can do it before serializing it would be the best
Thanks! Will try it out.
@Sunder Thanks so much! Works flawlessly 🙂
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.