I want to understand the reason and/or core-logic for JSONObject is being an un-ordered set. Because in most of my cases there would be a request which needs response as a JSONObject in the order of time/position. After searching, I found lot of members telling to use JSONArray which I do not feel a good solution.
I want to get a clear idea before proceeding further.
Thank you in advance.
JSONObjectis unordered because objects described by JSON are unordered, by specification:(Which is because JSON is derived from [is a subset of] JavaScript’s object initializer syntax, and JavaScript objects are unordered — because there’s no reason for the properties of an object to be ordered in the general case. That can be left to specializations of objects, like JavaScript’s arrays, which are nothing more than objects with some special handling of property names, and associated array-like functions.)