You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by Stefan Seifert <ss...@pro-vision.de> on 2017/02/21 07:34:46 UTC

[utils] support ordering for JSON objects in JSONParser?

i created FELIX-5556 to make sure JSON object order is retained when parsing a JSON file, and reverted the commit after the complaint from felix.

background:
- the original JSON spec [1] clearly defined JSON objects "is an unordered collection"
- the revised JSON spec [2] states the same, but adds an additional paragraph

"JSON parsing libraries have been observed to differ as to whether or
not they make the ordering of object members visible to calling
software.  Implementations whose behavior does not depend on member
ordering will be interoperable in the sense that they will not be
affected by these differences."

do we want to support it in the felix utils JSONParser? seems to set wrong expectations following the spec, but other much used libs as gson and jackson seem to do it by default. so if no one votes to explicitly support it i will cancel FELIX-5556.

stefan

[1] https://www.ietf.org/rfc/rfc4627.txt
[2] https://tools.ietf.org/html/rfc7159



Re: [utils] support ordering for JSON objects in JSONParser?

Posted by Achim Nierbeck <bc...@googlemail.com>.
Hi,

this is another reason to start thinking about using a "real" JSON parser
instead of using a simple string parser.
As in the other thread about comments, I think if a simple string parser
isn't enough, use an existing one,
for example Apache Johnzon[1].
In that case you don't have to worry about the parser fulfilling any specs
as that one surely does.

regards, Achim

[1] - http://johnzon.apache.org/


2017-02-21 8:41 GMT+01:00 David Leangen <os...@leangen.net>:

>
> I don’t particularly see a problem with it.
>
> +1 (for keeping, non binding)
>
>
> Cheers,
> =David
>
>
>
> > On Feb 21, 2017, at 4:34 PM, Stefan Seifert <ss...@pro-vision.de>
> wrote:
> >
> > i created FELIX-5556 to make sure JSON object order is retained when
> parsing a JSON file, and reverted the commit after the complaint from felix.
> >
> > background:
> > - the original JSON spec [1] clearly defined JSON objects "is an
> unordered collection"
> > - the revised JSON spec [2] states the same, but adds an additional
> paragraph
> >
> > "JSON parsing libraries have been observed to differ as to whether or
> > not they make the ordering of object members visible to calling
> > software.  Implementations whose behavior does not depend on member
> > ordering will be interoperable in the sense that they will not be
> > affected by these differences."
> >
> > do we want to support it in the felix utils JSONParser? seems to set
> wrong expectations following the spec, but other much used libs as gson and
> jackson seem to do it by default. so if no one votes to explicitly support
> it i will cancel FELIX-5556.
> >
> > stefan
> >
> > [1] https://www.ietf.org/rfc/rfc4627.txt
> > [2] https://tools.ietf.org/html/rfc7159
>
>
>


-- 

Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>

Software Architect / Project Manager / Scrum Master

Re: [utils] support ordering for JSON objects in JSONParser?

Posted by David Leangen <os...@leangen.net>.
I don’t particularly see a problem with it.

+1 (for keeping, non binding)


Cheers,
=David



> On Feb 21, 2017, at 4:34 PM, Stefan Seifert <ss...@pro-vision.de> wrote:
> 
> i created FELIX-5556 to make sure JSON object order is retained when parsing a JSON file, and reverted the commit after the complaint from felix.
> 
> background:
> - the original JSON spec [1] clearly defined JSON objects "is an unordered collection"
> - the revised JSON spec [2] states the same, but adds an additional paragraph
> 
> "JSON parsing libraries have been observed to differ as to whether or
> not they make the ordering of object members visible to calling
> software.  Implementations whose behavior does not depend on member
> ordering will be interoperable in the sense that they will not be
> affected by these differences."
> 
> do we want to support it in the felix utils JSONParser? seems to set wrong expectations following the spec, but other much used libs as gson and jackson seem to do it by default. so if no one votes to explicitly support it i will cancel FELIX-5556.
> 
> stefan
> 
> [1] https://www.ietf.org/rfc/rfc4627.txt
> [2] https://tools.ietf.org/html/rfc7159