Reputation: 456
I'm putting a json inside another like this:
JSONObject json = new JSONObject();
for(.....){
JSONObject v = new JSONObject();
v.put("key", "value");
v.put("key", "value");
v.put("key", "value");
json.put(i, v.toString());
i++;
}
The problem is that it is getting like this:
{"0":"{\"key\":\"value\",\"key\":\"value\",...}"}
Filled with "\", does anyone know how to withdraw or do the "right mode"?
Upvotes: 2
Views: 136
Reputation: 9437
cause you put string in json. change this:
from:
json.put(i, v.toString());
to:
json.put(i, v);
Upvotes: 5