I had received a json snippet, which has the following lines (string converted to json object)
"profile":{"id":"billg","name":"Bill Gates","countryCode":"US"}
now user adds one more profile, i need to convert profile object to an array of profile objects.
"profile":[{"id":"billg","name":"Bill Gates","countryCode":"US"},{"id":"steve","name":"Steve Jobs","countryCode":"US"}]
Any pointers or code is highly appreciated
It would be really great if you show some code of yours: we basically don’t know what’s the source of this json string (JSON = JavaScript Object Notation, so ‘JSON object’ is a tautology), and we don’t know how is the second profile created.
Consider this, though: