Thread: [json-lib-user] First impressions
Brought to you by:
aalmiray
From: Tim P. <tim...@ou...> - 2009-05-19 09:58:26
|
Hi, I am just starting with json-lib, and thought you might like to see where I bump into the furniture: I came to json-lib as a replacement for org.json in the hope of getting junit testing facilities, which I have got, thank you. I would be interested in more about FAQ 1, as I cannot see any situation in which a Bag is the right choice: the population order is of interest and should be preserved. To do otherwise is to throw information away. The bald statement "JSONObject uses a HashMap for its properties representation because the order of its properties is not important." is a bit strong for me. Whilst I am sure that it is correct I would like to know what would happen if this assumption were not so central. I like to round trip in unit tests, the throwing away of information, ie the deliberate removal of ordering means that I am unable to do this with ease, am not able to use string comparision for equality and have had to put in a lot of work. Would it not have been possible to preserve the ordering? Would the performance hot have been so bad? FAQ What is the relationship to json.org? It looks like you have stopped using Maven to actually build the artefacts, I am new to the list and would like to know why. When I checkout and type mvn install I get test failure (Kubuntu/sun java6/AMD64) cheers Tim [INFO] Surefire report directory: /dist/json-lib/target/surefire-reports org.apache.maven.surefire.booter.SurefireExecutionException: Unable to instantiate POJO 'class net.sf.json.TestJSONObject$PrefixerPropertyNameProcessor'; nested exception is java.lang.InstantiationException: net.sf.json.TestJSONObject$PrefixerPropertyNameProcessor; nested exception is org.apache.maven.surefire.testset.TestSetFailedException: Unable to instantiate POJO 'class net.sf.json.TestJSONObject$PrefixerPropertyNameProcessor'; nested exception is java.lang.InstantiationException: net.sf.json.TestJSONObject$PrefixerPropertyNameProcessor org.apache.maven.surefire.testset.TestSetFailedException: Unable to instantiate POJO 'class net.sf.json.TestJSONObject$PrefixerPropertyNameProcessor'; nested exception is java.lang.InstantiationException: net.sf.json.TestJSONObject$PrefixerPropertyNameProcessor java.lang.InstantiationException: net.sf.json.TestJSONObject$PrefixerPropertyNameProcessor at java.lang.Class.newInstance0(Class.java:340) at java.lang.Class.newInstance(Class.java:308) |
From: Tim P. <tim...@ou...> - 2009-05-19 10:14:19
|
On Tuesday 19 May 2009 10:58:08 Tim Pizey wrote: > Hi, > > I am just starting with json-lib, and thought you might like to see > where I bump into the furniture: Oh, I forgot, the main problem, which prompted me to join the list, is that the optional setting on the xom jar caused me to have a runtime error reported by a user. I use Maven so as to have my dependencies managed. I have never before encountered the optional flag. I am sure you have good reasons for using it, but thought you might like to know that it bit me. cheers Tim |
From: Andres A. <aal...@ya...> - 2009-05-19 15:28:31
|
Hi Tim, Thank you for checking out Json-lib, we hope it proves to be helpful to you. Now answers to your questions: "JSONObject uses a HashMap for its properties representation because the order of its properties is not important." - this is no longer true, as a matter of fact JSONObject uses a LinkedHashMap to preserver insertion order, the FAQ must be updated. Have in mind that the JSON semantics still declare a JSONObject to be a Bag, per the spec. " What is the relationship to json.org?" - Json-lib was born from the code found at json.org and evolved from there. "It looks like you have stopped using Maven to actually build the artefacts, I am new to the list and would like to know why." - this is due to the current jdk3/jdk5 setup, given that maven is unable to handle several source paths that may contain "duplicate" class definitions. We tried using maven's ant plugin but it didn't quite work, nor maven's profile option. These days the Ant build does all the work, but still uses the pom file for dependency management "Oh, I forgot, the main problem, which prompted me to join the list, is that the optional setting on the xom jar caused me to have a runtime error reported by a user. " - an optional dependency means you don't need to download it in order to use the library, however you must download it in order to compile one part of the library (xml support). Cheers, Andres ------------------------------------------- http://jroller.com/aalmiray http://www.linkedin.com/in/aalmiray -- What goes up, must come down. Ask any system administrator. There are 10 types of people in the world: Those who understand binary, and those who don't. To understand recursion, we must first understand recursion. ________________________________ From: Tim Pizey <tim...@ou...> To: jso...@li... Sent: Tuesday, May 19, 2009 2:58:08 AM Subject: [json-lib-user] First impressions Hi, I am just starting with json-lib, and thought you might like to see where I bump into the furniture: I came to json-lib as a replacement for org.json in the hope of getting junit testing facilities, which I have got, thank you. I would be interested in more about FAQ 1, as I cannot see any situation in which a Bag is the right choice: the population order is of interest and should be preserved. To do otherwise is to throw information away. The bald statement "JSONObject uses a HashMap for its properties representation because the order of its properties is not important." is a bit strong for me. Whilst I am sure that it is correct I would like to know what would happen if this assumption were not so central. I like to round trip in unit tests, the throwing away of information, ie the deliberate removal of ordering means that I am unable to do this with ease, am not able to use string comparision for equality and have had to put in a lot of work. Would it not have been possible to preserve the ordering? Would the performance hot have been so bad? FAQ What is the relationship to json.org? It looks like you have stopped using Maven to actually build the artefacts, I am new to the list and would like to know why. When I checkout and type mvn install I get test failure (Kubuntu/sun java6/AMD64) cheers Tim [INFO] Surefire report directory: /dist/json-lib/target/surefire-reports org.apache.maven.surefire.booter.SurefireExecutionException: Unable to instantiate POJO 'class net.sf.json.TestJSONObject$PrefixerPropertyNameProcessor'; nested exception is java.lang.InstantiationException: net.sf.json.TestJSONObject$PrefixerPropertyNameProcessor; nested exception is org.apache.maven.surefire.testset.TestSetFailedException: Unable to instantiate POJO 'class net.sf.json.TestJSONObject$PrefixerPropertyNameProcessor'; nested exception is java.lang.InstantiationException: net.sf.json.TestJSONObject$PrefixerPropertyNameProcessor org.apache.maven.surefire.testset.TestSetFailedException: Unable to instantiate POJO 'class net.sf.json.TestJSONObject$PrefixerPropertyNameProcessor'; nested exception is java.lang.InstantiationException: net.sf.json.TestJSONObject$PrefixerPropertyNameProcessor java.lang.InstantiationException: net.sf.json.TestJSONObject$PrefixerPropertyNameProcessor at java.lang.Class.newInstance0(Class.java:340) at java.lang.Class.newInstance(Class.java:308) ------------------------------------------------------------------------------ Crystal Reports - New Free Runtime and 30 Day Trial Check out the new simplified licensing option that enables unlimited royalty-free distribution of the report engine for externally facing server and web deployment. http://p.sf.net/sfu/businessobjects _______________________________________________ json-lib-user mailing list jso...@li... https://lists.sourceforge.net/lists/listinfo/json-lib-user |
From: Tim P. <tim...@ou...> - 2009-05-19 16:28:35
|
Hi Andres, On Tuesday 19 May 2009 16:28:26 Andres Almiray wrote: > Hi Tim, > > Thank you for checking out Json-lib, we hope it proves to be helpful to > you. Now answers to your questions: > > > "JSONObject uses a HashMap for its properties > representation because the order of its properties is not important." > - this is no longer true, as a matter of fact JSONObject uses a > LinkedHashMap to preserver insertion order, the FAQ must be updated. Have > in mind that the JSON semantics still declare a JSONObject to be a Bag, per > the spec. Good, I thought so, as I had looked at the code and saw you were now preserving insertion order. > " What is the relationship to json.org?" > - Json-lib was born from the code found at json.org and evolved from there. Yes, but Mr Crockford is not actually a developer on this project? I think it is important to spell out clearly whether this is a derived project or one that is actively developed by the originators of JSON. [snip - ant usage] > "Oh, I forgot, the main problem, which prompted me to join the list, > is that the optional setting on the xom jar caused me to have a runtime > error reported by a user. " > - an optional dependency means you don't need to download it in order to > use the library, however you must download it in order to compile one part > of the library (xml support). yes, I know what it means, now, after it caused me pain. I see the use of optional for the ORO library, but not for XOM you have askd be to read your POM and determine whether I need to manuall include the XOM jar. This is not the Maven way. I am happy to download enormous numbers of jars that I may or may not need, I am not happy having to make decisions about it. I think removing optional on the XOM jar would be good. > Cheers, > Andres cheers and thanks for your library Tim |