json and querys

gemasoft

Member
Licensed User
Longtime User
Hi , i have a application that resolve an dynamic sql .

For example i send using a webservice

select name, surname, address, telephone from customers

when i receive the fields i use json for decode and i receive:

name, telephone, address, surname

the fields are dynamics, but when i convert from json to map. then the order change and i don't know why ocurrs this.

Is possible know what criteria use json for decode?
 

win

New Member
Licensed User
Longtime User
Json parser changing order in Map

I am also experiencing this. The JSON reply string I have contains all the entities in a certain order, but when converting to a map the order gets re-arranged. All the data is intact, but the sequence of data pairs gets altered.

I have log'ed the initial string, the JSON object and the map conversion.

The first two (the string and the JSON object) show the same order; the map object alters the order.

Here is the snippet of code (note the log calls)
Sub hc_ResponseSuccess (Response As HttpResponse, TaskId As Int)
Dim res As String
res = Response.GetString("UTF8")

Dim JSON As JSONParser
Dim Map1 As Map
JSON.Initialize(res)
Map1 = json.nextobject

Log(res)
Log(Json)
Log(Map1)
End sub

And the results (truncated for length and for privacy concerns -- this is live data) of the log() outputs:

{"Answer":{"ContractorID":"777","ShowID":"0123456789","IDCode":"81223","FirstName":""," <deleted stuff follows>

(JSONTokener) at character 438 of {"Answer":{"ContractorID":"777","ShowID":"0123456789","IDCode":"81223","FirstName":""," <deleted stuff follows>

(MyMap) {Answer={Phone=Opted Out, ShowID=0123456789, Fax=Interventional C, Country=(555) 555-8143, LastName= <deleted stuff follows>

Is there some way of controlling the output order, or am I missing something?
 
Upvote 0
Top