I have code that looks something like this:
import net.sf.json.*;--just so you know what the library is
...
JSONArray a = new JSONArray();
JSONObject p = new JSONObject();
p.put("some_attribute1","some normal string");
p.put("some_attribute2","[3something]");
p.put("some_attribute3","[something3]");
a.add(p);
System.out.println(a.toString());
This produces:
[
{
"some_attribute1":"some normal string",
"some_attribute2":["3something"],
"some_attribute3":"[something3]"
}
]
instead of the desired result:
[
{
"some_attribute1":"some normal string",
"some_attribute2":"[3something]",
"some_attribute3":"[something3]"
}
]
Notice the difference between "some_attribute2" being an array in the actual output versus a string in the desired output. Can anyone explain why this is? Also if there is a term for what is going to better categorize my question?