Skip to main content

JSON and ArrayList question

1 reply [Last post]
alak
Offline
Joined: 2006-03-12
Points: 0

Did anyone know how to put a resultset arraylist into jsonObject in correct order?
Resultset have column name, label, abbreviation
When I use json.put(items,"result"), but the order was wrong.
I want to get the json result like this.
{identifier:";abbreviation",
label:label,
items: [
{name:"Alabama", label:"Alabama",abbreviation:"AL"},
{name:"Arizona", label:"Arizona",abbreviation:"AZ"},
{name:"Arkansas", label:"Arkansas",abbreviation:"AR"},
]}

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
sloanb
Offline
Joined: 2003-09-14
Points: 0

Currently the only way I have found around this is to do the sort yourself. If you need examples i will be happy to provide them.