I need to store many values in single key of json. e.g.
{ "number" : "1","2","3", "alphabet" : "a", "b", "c" }
Something like this. Any pointers?
Use arrays:
{ "number": ["1", "2", "3"], "alphabet": ["a", "b", "c"] }
You can the access the different values from their position in the array. Counting starts at left of array at 0. myJsonObject["number"][0] == 1 or myJsonObject["alphabet"][2] == 'c'
myJsonObject["number"][0] == 1
myJsonObject["alphabet"][2] == 'c'
2.1m questions
2.1m answers
60 comments
57.0k users