I am using cartoDB database and making a web application. I have a data in my database which you can view it from here and its public https://farook.cartodb.com/tables/entire_data. The response of the query would be json. I have two accounts created in cartoDB database but the same data given in the above link is there in both the accounts. The problem is when i do query and get a json response, the json differs for the same data from two different accounts. You can view the json response of one account enter image description here where the order of the first row is cartodb_id, the_geom, the_geom_webmercator, 2007_dec and so on. and the json response for the same data from other account is also here enter image description here where the order is cartodb_id, the_geom, the_geom_webmercator, region_name, 1990_january and so on. Why it behaves so? WHat would be the problem for different responses?

1 Answer 1


If the only difference between two json ouputs is the order of the keys it is something normal. The JSON spec does not says nothing about the order that must follow the keys, neither the cartodb sql api.

Paste your json in any of the online formatter tools available to check if there are more differences or use a json diff tool.

  • The order is descending in one json and its ascending on other json. Order of the key is important for my application. Is there any other way?
    – User123
    Jan 7, 2016 at 10:20
  • 2
    Instead of use '*' type all the columns in your desired order. This will work, but i think that rely in the order of the keys will be a headache in the future. Jan 7, 2016 at 19:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.