Results 1 to 4 of 4
Thread: Put JSONObject to JSONArray?
- 04-02-2010, 10:55 AM #1
Member
- Join Date
- Jan 2010
- Posts
- 10
- Rep Power
- 0
Put JSONObject to JSONArray?
I have a need to put() a JSONObject into a JSONArray. For some reason, it seems no one's attempted this in Java, so I'm having trouble finding an answer. It's possible to directly retrieve a JSONObject from a JSONArray - the inability to go the other way around seems like a major oversight. Am I overlooking something?
- 04-02-2010, 11:39 AM #2
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 7
Uhm, what is wrong with this method?
or this method?Java Code:public JSONArray put(java.lang.Object value)
Java Code:public JSONArray put(int index, java.lang.Object value)
- 04-02-2010, 02:36 PM #3
Member
- Join Date
- Jan 2010
- Posts
- 10
- Rep Power
- 0
It refuses to accept a JSONObject. Even one that has just been extracted from another JSONArray, without anything done to it. Any other type of object works fine. And I can absolutely confirm that both JSONObjects and JSONArrays work as expected otherwise, as this program has been running on them for quite some time.
However, I'm working on a solution... that involves creating my own JSON parser. I'm rather sick of distributing 1.3MB worth of jars in 6 files with my under-100KB program.
- 04-03-2010, 09:04 AM #4
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 7


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks