Hello,
I've been trying to solve this for couple of hours now. I need to transform
Collection<Vehicle> to JSONObject, where
Vehicle (id = 1, regNr = 2) -> JSONObject.toString() == "{'id':'1',
'regNr':'2'}"
{Vehicle (id = 1, regNr = 2), Vehicle (id = 2, regNr = 6)} ->
JSONObject.toString() == "{'id':'1,2', 'regNr':'2,6'}" (not "{'id':'1',
'regNr':'2'}, {'id':'2', 'regNr':'6'}")
JSONSerializer.fromObject(Collection) returns an array of separate objects
transformed to JSON ("{'id':'1', 'regNr':'2'}, {'id':'2', 'regNr':'6'}").
Of course I could do the needed transformation by hand, but I'm sure there's
something in the API that I'm missing.
|