Org.json with JavaME insert random number into toString ()
I am creating a BlackBerry application in Java and reading / writing JSON. I am using the org.json.me package included in the SDK.
When I generate a complex JSONObject and run the toString () method on it to send the data I see, a seemingly random number appears in the string that splits the JSON
{"cb_aggregate_key":
[
{"$project":{"Symbol":"1","Price":"1","total":"1"}},
{"$group":[8835.281] {"_id":"$Symbol","total":{"$sum":"$Price"}}}
]
}
Note that at the beginning of the $ group object, I have [8835.281], which is not part of my object. I tried to register toString () the JSONObject inserted under the "$ group" key and it looks correct
{"_id":"$Symbol","total":{"$sum":"$Price"}}
At first I thought it might be a strange character in my lines, but I can't find anything.
Then I noticed that even when reading JSON responses from the http://cloudbase.io API, I was successfully converting the string to JSONOjbect. When I then print the output on which the toString () method of the JSONObject works, I see random numbers as well:
{"register-device":
{
"status":"OK",
"message":{
"output":"register 2013-01-31[8832.953] T13:49:41+00:00 553648138",
"sessionid":"510a767592a578064d0001d2"
},
"error":""
}
}
Notice [8832.953] appearing in the "output" line.
Has anyone seen this behavior before?
source to share