Re: [json-lib-user] Order of child elements is switched when converting from json to xml
Brought to you by:
aalmiray
From: Olivier C. <oli...@gm...> - 2011-11-22 14:48:02
|
I though the "reply-all" was set to reply to jso...@li...! :-) Thanks for your reply anyway. Hope someone can react since I could not play with bug reports on Sourceforge! Olivier On Tue, Nov 22, 2011 at 3:25 PM, Morgan Packard <mo...@mo...>wrote: > I'm afraid I'm just a dumb user of this project, I'm not involved in > authoring or maintaining it in any way, so i'm not the right guy to ask > about line 942. > -Morgan > > > On Tue, Nov 22, 2011 at 3:52 AM, Olivier Chirouze < > oli...@gm...> wrote: > >> Ok, I found what I see as a very strange... bug? >> >> Line 942 of XMLSerializer.java, in method processJSONObject(), I found... >> >> Arrays.sort( names ); >> >> Why is it there for? I don't see the point in sorting elements, >> especially if the output is to be an XML. To me this line is 100% useless. >> >> I found existing bug entries on sourceforge and will try to push the >> resolution of these. >> >> Olivier >> >> >> On Tue, Nov 22, 2011 at 9:11 AM, Olivier Chirouze < >> oli...@gm...> wrote: >> >>> I agree with you. >>> But XML elements ARE ordered, right? >>> So, when one passes a list of JSON objects in a specific order, why >>> change that order when converting to XML??? >>> >>> >>> On Mon, Nov 21, 2011 at 5:49 PM, Morgan Packard < >>> mo...@mo...> wrote: >>> >>>> I was under the impression that json dictionaries are unordered >>>> according to the spec. >>>> >>>> from json.org: >>>> >>>> JSON is built on two structures: >>>> >>>> - A collection of name/value pairs. In various languages, this is >>>> realized as an *object*, record, struct, dictionary, hash table, >>>> keyed list, or associative array. >>>> - An ordered list of values. In most languages, this is realized as >>>> an *array*, vector, list, or sequence. >>>> >>>> >>>> >>>> On Mon, Nov 21, 2011 at 11:45 AM, Olivier Chirouze < >>>> oli...@gm...> wrote: >>>> >>>>> Hi there, >>>>> >>>>> I am playing with JSON lib conversion from JSON to XML and the >>>>> opposite. >>>>> I am now facing a strange issue: converting from json string to XML >>>>> seems to loose the order of elements in the process. >>>>> However in debug I can make sure the "insertOrder" property of my >>>>> JSONObject is right! But xmlSerializer.write(myJSONObject) returns an XML >>>>> string where child elements have been mixed up (seems to be exactly the >>>>> opposite order!!...) >>>>> >>>>> What should I do? >>>>> >>>>> Thanks >>>>> >>>>> >>>>> ------------------------------------------------------------------------------ >>>>> All the data continuously generated in your IT infrastructure >>>>> contains a definitive record of customers, application performance, >>>>> security threats, fraudulent activity, and more. Splunk takes this >>>>> data and makes sense of it. IT sense. And common sense. >>>>> http://p.sf.net/sfu/splunk-novd2d >>>>> _______________________________________________ >>>>> json-lib-user mailing list >>>>> jso...@li... >>>>> https://lists.sourceforge.net/lists/listinfo/json-lib-user >>>>> >>>>> >>>> >>> >> > |