Reputation: 2148
I'm using java, json.simple.JSONObject. I have a json object inside which I have a json array. I want to add empty values in a given postion
{"rows_map":{"2":["test1a","2011-12-08 18:13:50.6"],"1":["test2","2011-12-07 11:51:11.237"]}
Suppose i want to add values at second position
{"rows_map":{"2":["test1a","","2011-12-08 18:13:50.6"],"1":["test2","","2011-12-07 11:51:11.237"]}
How can I do this?
Upvotes: 2
Views: 2668
Reputation: 30855
you can put the value by passing it's position for example
jsonarr.put(1,"");
check here for more http://www.json.org/javadoc/org/json/JSONArray.html
Upvotes: 2