json-lib-user Mailing List for Json-lib (Page 4)
Brought to you by:
aalmiray
You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(6) |
Sep
(5) |
Oct
(1) |
Nov
(7) |
Dec
(5) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(4) |
Feb
(5) |
Mar
(1) |
Apr
|
May
(11) |
Jun
(3) |
Jul
(12) |
Aug
(4) |
Sep
(8) |
Oct
(11) |
Nov
(7) |
Dec
(30) |
2008 |
Jan
(11) |
Feb
(15) |
Mar
(8) |
Apr
|
May
(9) |
Jun
(21) |
Jul
(1) |
Aug
(4) |
Sep
(1) |
Oct
|
Nov
(3) |
Dec
(8) |
2009 |
Jan
(6) |
Feb
(1) |
Mar
(3) |
Apr
(5) |
May
(10) |
Jun
(3) |
Jul
(1) |
Aug
|
Sep
(4) |
Oct
(1) |
Nov
(1) |
Dec
(1) |
2010 |
Jan
|
Feb
(2) |
Mar
(2) |
Apr
(3) |
May
(5) |
Jun
(1) |
Jul
|
Aug
(4) |
Sep
|
Oct
(1) |
Nov
(4) |
Dec
|
2011 |
Jan
|
Feb
(1) |
Mar
(1) |
Apr
|
May
|
Jun
(3) |
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
(8) |
Dec
|
2012 |
Jan
|
Feb
|
Mar
(4) |
Apr
|
May
(1) |
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
2014 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Ronald R. D. <ron...@gm...> - 2009-03-13 13:59:39
|
All, I am attempting to do the following with Groovy: http.request( GET, JSON ) { url.query = [ sourceName:'avm://portal--admin/-1;www;avm_webapps;ROOT;DCP_4963.JPG', destName:'HHMI Documents/images', name:'ronCopy.jpg', remove:'false' ] requestContentType : JSON // response handler for a success response code: response.success = { resp, json -> println resp.statusLine // parse the JSON response object: json.responseData.results.each { println " ${it.titleNoFormatting} : ${it.visibleUrl}" } } // handler for any failure status code: response.failure = { resp -> println "Unexpected error: ${resp.statusLine.statusCode} : ${resp.statusLine.reasonPhrase}" } } The response JSON looks like the following: { "node" : { "projectOverviewLocation" : "workspace://SpacesStore/d83b8a9b-8685-40d4-b045-5def043b85a5" } } Which to me looks like valid JSON, but I get the following exception: Exception thrown: Invalid JSON String net.sf.json.JSONException: Invalid JSON String at net.sf.json.JSONSerializer.toJSON(JSONSerializer.java:143) at net.sf.json.JSONSerializer.toJSON(JSONSerializer.java:103) at net.sf.json.groovy.JsonSlurper.parseText(JsonSlurper.java:78) at groovyx.net.http.ParserRegistry.parseJSON(ParserRegistry.java:185) at groovyx.net.http.HTTPBuilder.doRequest(HTTPBuilder.java:461) at groovyx.net.http.HTTPBuilder.doRequest(HTTPBuilder.java:407) at groovyx.net.http.HTTPBuilder.request(HTTPBuilder.java:360) at ConsoleScript52.run(ConsoleScript52:9) Any reason why that might be occurring? -- Ron DiFrango http://rdifrango.blogspot.com/ |
From: stuart m. <stu...@ho...> - 2009-03-03 17:42:02
|
I'm trying to parse a JSON string into/from a bean's property. It works fine, except for mapping an array[][][] to a property. Using a sample piece of JSON, adding a subelement e.g. circles, has me stumped. How do I get the array into the bean's property? Ideally, the property holding the array "circles" would be an arrayList or array of circles, with inner circles and finally point objects. How do I achieve this? I couldn't see how to achieve this. Stub code below. Thanks, Stuart JSONObject jsonObjectMyBean = (JSONObject) JSONSerializer.toJSON( sampleJSONString ); JsonConfig jsonConfigMyBean = new JsonConfig(); jsonConfigMyBean.setRootClass( MyBean.class ); MyBean MyBean= (MyBean) JSONSerializer.toJava( jsonObjectMyBean, jsonConfigMyBean); MyBean { String type; String name; String classType; (?unknown type) Object Circles - It's an Object circles; //it comes through as an arraylist<object> with two inner arraylists. Drilling into the first element is an arraylist<Object> it has [[98.4375,-45],[99.140625,-49.5703125]], the next arraylist has [98.4375, -45], so item 0 is 98.4 etc. //suitable getters/setters } the sample jsonString is { "type": "geometry", "circles": [ //e.g. circles0 [ //e.g circle0 [ //e.g. point0 98.4375, -45.90 ], [ 99.140625, -49.5703125 ] ] ], "name": "test_name", "classType": "className" } _________________________________________________________________ 25GB of FREE Online Storage – Find out more http://clk.atdmt.com/UKM/go/134665320/direct/01/ |
From: Francesco B. <fbr...@ar...> - 2009-02-22 15:45:54
|
Hallo all, i would like to inform that we use json-lib in our open source project EBI Neutrino R1 Open Source CRM / ERP Framework. It is a very indispensable lib for us for communication between WEB Client and NeutrinoR1 Server. Regards Francesco |
From: Thomas W. <tho...@du...> - 2009-01-14 09:05:49
|
Hi Andres,I am using version 2.2.3. Regards, Tom 2009/1/14 Andres Almiray <aal...@ya...> > Hi Thomas, > > Sorry for the late reply. I think we recently fixed a bug request regarding > couchdb and json-lib integration, which I believe should be in the latest > stable release, which version of json-lib are you testing with? > > 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:* Thomas Williams <tho...@du...> > *To:* Morgan Packard <hel...@gm...>; > jso...@li... > *Sent:* Sunday, January 11, 2009 2:19:13 PM > *Subject:* Re: [json-lib-user] Incompatibilities in encoding JSON objects > > Morgan,I'm having a play around with couch DB which has a JSON interface, > and for some reason the interface to some of the functions require you to > send the functions enclosed in quote marks, I guess the erlang JSON > libraries must be a little stricter in their definition of what is JSON > (there isn't a 'function' keyword in strict JSON is there?) Anyway, I think > I can find find a way around this another way, but thanks for your insights. > > Tom > > 2009/1/11 Morgan Packard <hel...@gm...> > >> Well, my stab in the dark didn't work. Just curious--why do you need a >> string that looks like a function anyway? >> >> Sent from my iPhone >> >> On Jan 11, 2009, at 6:30 AM, Thomas Williams < >> tho...@du...> wrote: >> >> Thanks Morgan, I did try this, and it does force json-lib to put quotes >> around the value, however it then also adds the quotes that I've put in >> manually! So you end up with: >> >> { "key" : "\"function(value){}\"" } >> >> Tom >> >> 2009/1/10 Morgan Packard < <mpa...@ke...> >> mpa...@ke...> >> >>> just a guess, I should say. But that's what I'd try first. >>> >>> >>> On Sat, Jan 10, 2009 at 6:11 PM, Morgan Packard <<mpa...@ke...> >>> mpa...@ke...> wrote: >>> >>>> escape the quotes. >>>> >>>> I think: >>>> >>>> obj.accumulate("key","\"function(value){}\""); >>>> >>>> On Sat, Jan 10, 2009 at 4:33 PM, Thomas Williams <<tho...@du...> >>>> tho...@du...> wrote: >>>> >>>>> Hi Chaps, I have noticed a difference in the encoding of JSON objects >>>>> when the key I am encoding looks like a Javascript function. If I try the >>>>> following: >>>>> >>>>> >>>>> final JSONObject obj = new JSONObject(); >>>>> obj.accumulate("key","value"); >>>>> System.out.println(obj.toString()); >>>>> >>>>> It outputs: >>>>> >>>>> {"key" : "value"} >>>>> >>>>> If however I try this instead: >>>>> >>>>> final JSONObject obj = new JSONObject(); >>>>> obj.accumulate("key","function(value){}"); >>>>> System.out.println(obj.toString()); >>>>> >>>>> It outputs: >>>>> >>>>> {"key" : function(value){}} >>>>> >>>>> Note the lack of quote marks around the value. Is there any way I can >>>>> force it to add quote marks around that value? >>>>> >>>>> regards, >>>>> Tom >>>>> >>>>> -- >>>>> Thomas Williams >>>>> Java Programmer >>>>> Dubit Limited >>>>> +44 1133 947920 >>>>> <http://www.dubitlimited.com>www.dubitlimited.com >>>>> >>>>> >>>>> ------------------------------------------------------------------------------ >>>>> Check out the new SourceForge.net Marketplace. >>>>> It is the best place to buy or sell services for >>>>> just about anything Open Source. >>>>> <http://p.sf.net/sfu/Xq1LFB>http://p.sf.net/sfu/Xq1LFB >>>>> _______________________________________________ >>>>> json-lib-user mailing list >>>>> <jso...@li...> >>>>> jso...@li... >>>>> <https://lists.sourceforge.net/lists/listinfo/json-lib-user> >>>>> https://lists.sourceforge.net/lists/listinfo/json-lib-user >>>>> >>>>> >>>> >>>> >>>> -- >>>> +++++++++++++++++++++++++++++++++++++++ >>>> morganpackard.com >>>> <http://myspace.com/morganpackard>myspace.com/morganpackard >>>> finediving.org >>>> anticipaterecordings.com >>>> (646) 206-8337 >>>> >>> >>> >>> >>> -- >>> +++++++++++++++++++++++++++++++++++++++ >>> morganpackard.com >>> <http://myspace.com/morganpackard>myspace.com/morganpackard >>> finediving.org >>> anticipaterecordings.com >>> (646) 206-8337 >>> >> >> >> >> -- >> Thomas Williams >> Java Programmer >> Dubit Limited >> +44 1133 947920 >> <http://www.dubitlimited.com>www.dubitlimited.com >> >> > > > -- > Thomas Williams > Java Programmer > Dubit Limited > +44 1133 947920 > www.dubitlimited.com > > -- Thomas Williams Java Programmer Dubit Limited +44 1133 947920 www.dubitlimited.com |
From: Thomas W. <tho...@du...> - 2009-01-11 22:19:20
|
Morgan,I'm having a play around with couch DB which has a JSON interface, and for some reason the interface to some of the functions require you to send the functions enclosed in quote marks, I guess the erlang JSON libraries must be a little stricter in their definition of what is JSON (there isn't a 'function' keyword in strict JSON is there?) Anyway, I think I can find find a way around this another way, but thanks for your insights. Tom 2009/1/11 Morgan Packard <hel...@gm...> > Well, my stab in the dark didn't work. Just curious--why do you need a > string that looks like a function anyway? > > Sent from my iPhone > > On Jan 11, 2009, at 6:30 AM, Thomas Williams < > tho...@du...> wrote: > > Thanks Morgan,I did try this, and it does force json-lib to put quotes > around the value, however it then also adds the quotes that I've put in > manually! So you end up with: > > { "key" : "\"function(value){}\"" } > > Tom > > 2009/1/10 Morgan Packard < <mpa...@ke...> > mpa...@ke...> > >> just a guess, I should say. But that's what I'd try first. >> >> >> On Sat, Jan 10, 2009 at 6:11 PM, Morgan Packard <<mpa...@ke...> >> mpa...@ke...> wrote: >> >>> escape the quotes. >>> >>> I think: >>> >>> obj.accumulate("key","\"function(value){}\""); >>> >>> On Sat, Jan 10, 2009 at 4:33 PM, Thomas Williams <<tho...@du...> >>> tho...@du...> wrote: >>> >>>> Hi Chaps, I have noticed a difference in the encoding of JSON objects >>>> when the key I am encoding looks like a Javascript function. If I try the >>>> following: >>>> >>>> >>>> final JSONObject obj = new JSONObject(); >>>> obj.accumulate("key","value"); >>>> System.out.println(obj.toString()); >>>> >>>> It outputs: >>>> >>>> {"key" : "value"} >>>> >>>> If however I try this instead: >>>> >>>> final JSONObject obj = new JSONObject(); >>>> obj.accumulate("key","function(value){}"); >>>> System.out.println(obj.toString()); >>>> >>>> It outputs: >>>> >>>> {"key" : function(value){}} >>>> >>>> Note the lack of quote marks around the value. Is there any way I can >>>> force it to add quote marks around that value? >>>> >>>> regards, >>>> Tom >>>> >>>> -- >>>> Thomas Williams >>>> Java Programmer >>>> Dubit Limited >>>> +44 1133 947920 >>>> <http://www.dubitlimited.com>www.dubitlimited.com >>>> >>>> >>>> ------------------------------------------------------------------------------ >>>> Check out the new SourceForge.net Marketplace. >>>> It is the best place to buy or sell services for >>>> just about anything Open Source. >>>> <http://p.sf.net/sfu/Xq1LFB>http://p.sf.net/sfu/Xq1LFB >>>> _______________________________________________ >>>> json-lib-user mailing list >>>> <jso...@li...> >>>> jso...@li... >>>> <https://lists.sourceforge.net/lists/listinfo/json-lib-user> >>>> https://lists.sourceforge.net/lists/listinfo/json-lib-user >>>> >>>> >>> >>> >>> -- >>> +++++++++++++++++++++++++++++++++++++++ >>> morganpackard.com >>> <http://myspace.com/morganpackard>myspace.com/morganpackard >>> finediving.org >>> anticipaterecordings.com >>> (646) 206-8337 >>> >> >> >> >> -- >> +++++++++++++++++++++++++++++++++++++++ >> morganpackard.com >> <http://myspace.com/morganpackard>myspace.com/morganpackard >> finediving.org >> anticipaterecordings.com >> (646) 206-8337 >> > > > > -- > Thomas Williams > Java Programmer > Dubit Limited > +44 1133 947920 > <http://www.dubitlimited.com>www.dubitlimited.com > > -- Thomas Williams Java Programmer Dubit Limited +44 1133 947920 www.dubitlimited.com |
From: Thomas W. <tho...@du...> - 2009-01-11 12:44:31
|
Thanks Morgan,I did try this, and it does force json-lib to put quotes around the value, however it then also adds the quotes that I've put in manually! So you end up with: { "key" : "\"function(value){}\"" } Tom 2009/1/10 Morgan Packard <mpa...@ke...> > just a guess, I should say. But that's what I'd try first. > > > On Sat, Jan 10, 2009 at 6:11 PM, Morgan Packard <mpa...@ke...>wrote: > >> escape the quotes. >> >> I think: >> >> obj.accumulate("key","\"function(value){}\""); >> >> On Sat, Jan 10, 2009 at 4:33 PM, Thomas Williams < >> tho...@du...> wrote: >> >>> Hi Chaps, I have noticed a difference in the encoding of JSON objects >>> when the key I am encoding looks like a Javascript function. If I try the >>> following: >>> >>> >>> final JSONObject obj = new JSONObject(); >>> obj.accumulate("key","value"); >>> System.out.println(obj.toString()); >>> >>> It outputs: >>> >>> {"key" : "value"} >>> >>> If however I try this instead: >>> >>> final JSONObject obj = new JSONObject(); >>> obj.accumulate("key","function(value){}"); >>> System.out.println(obj.toString()); >>> >>> It outputs: >>> >>> {"key" : function(value){}} >>> >>> Note the lack of quote marks around the value. Is there any way I can >>> force it to add quote marks around that value? >>> >>> regards, >>> Tom >>> >>> -- >>> Thomas Williams >>> Java Programmer >>> Dubit Limited >>> +44 1133 947920 >>> www.dubitlimited.com >>> >>> >>> ------------------------------------------------------------------------------ >>> Check out the new SourceForge.net Marketplace. >>> It is the best place to buy or sell services for >>> just about anything Open Source. >>> http://p.sf.net/sfu/Xq1LFB >>> _______________________________________________ >>> json-lib-user mailing list >>> jso...@li... >>> https://lists.sourceforge.net/lists/listinfo/json-lib-user >>> >>> >> >> >> -- >> +++++++++++++++++++++++++++++++++++++++ >> morganpackard.com >> myspace.com/morganpackard >> finediving.org >> anticipaterecordings.com >> (646) 206-8337 >> > > > > -- > +++++++++++++++++++++++++++++++++++++++ > morganpackard.com > myspace.com/morganpackard > finediving.org > anticipaterecordings.com > (646) 206-8337 > -- Thomas Williams Java Programmer Dubit Limited +44 1133 947920 www.dubitlimited.com |
From: Thomas W. <tho...@du...> - 2009-01-10 22:23:14
|
Hi Chaps,I have noticed a difference in the encoding of JSON objects when the key I am encoding looks like a Javascript function. If I try the following: final JSONObject obj = new JSONObject(); obj.accumulate("key","value"); System.out.println(obj.toString()); It outputs: {"key" : "value"} If however I try this instead: final JSONObject obj = new JSONObject(); obj.accumulate("key","function(value){}"); System.out.println(obj.toString()); It outputs: {"key" : function(value){}} Note the lack of quote marks around the value. Is there any way I can force it to add quote marks around that value? regards, Tom -- Thomas Williams Java Programmer Dubit Limited +44 1133 947920 www.dubitlimited.com |
From: Thomas W. <tho...@du...> - 2009-01-10 19:50:47
|
Hi Chaps,I have noticed a difference in the encoding of JSON objects when the key I am encoding looks like a Javascript function. If I try the following: final JSONObject obj = new JSONObject(); obj.accumulate("key","value"); System.out.println(obj.toString()); It outputs: {"key" : "value"} If however I try this instead: final JSONObject obj = new JSONObject(); obj.accumulate("key","function(value){}"); System.out.println(obj.toString()); It outputs: {"key" : function(value){}} Note the lack of quote marks around the value. Is there any way I can force it to add quote marks around that value? regards, Tom -- Thomas Williams Java Programmer Dubit Limited +44 1133 947920 www.dubitlimited.com |
From: Morgan P. <mpa...@ke...> - 2009-01-08 20:23:04
|
Hello, I'm just getting started with json-lib, and it looks very nice so far. I'm very happy to see that it was designed with some flexibility/control in mind, for example the ability to filter out properties using "setJsonPropertyFilter". I'd like to go a step further and actually control the way in which some properties are serialized. For example, I have a property ("startDate") which is a GregorianCalendar. Rather than serializing the entire contens of the calendar into json ( {"startDate":{"firstDayOfWeek":1,"gregorianChange":{"date... ), I'd like to simply populate this property with a string ("startDate" : "Monday, December 1st" ). So, I need a way to intercept all instances of GregorianCalendar, and create my own serialization for them. Any ideas? thanks, -Morgan |
From: Jeyaram G. <jey...@gm...> - 2008-12-15 22:40:31
|
Dear Andres, Thank you very much for your quick response. Regards Jeyaram On Tue, Dec 16, 2008 at 5:33 AM, Andres Almiray <aal...@ya...> wrote: > Hi Jeyaram, > > At the moment it is not possible to use Java serialization as those classes > do not implement the marker Serializable interface, but I don't see why they > couldn't in a future release, given that they should contain simple values. > I'll add a FR to the site to keep track of this. > > 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:* Jeyaram Gurusamy <jey...@gm...> > *To:* jso...@li... > *Sent:* Sunday, December 14, 2008 3:07:24 PM > *Subject:* [json-lib-user] Is JSONArray serializable ? > > Dear All, > > I am trying to store a JSONArray into a caching solution that expect the > objects to be serializable. > > JSONArray doesn't seem to implement serializable. > > Is there any way to store JSONArray or JSONObject into a cache that expect > them to be serializable ? > > > Thank you > > Regards > Jeyaram > > > |
From: Andres A. <aal...@ya...> - 2008-12-15 18:33:47
|
Hi Jeyaram, At the moment it is not possible to use Java serialization as those classes do not implement the marker Serializable interface, but I don't see why they couldn't in a future release, given that they should contain simple values. I'll add a FR to the site to keep track of this. 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: Jeyaram Gurusamy <jey...@gm...> To: jso...@li... Sent: Sunday, December 14, 2008 3:07:24 PM Subject: [json-lib-user] Is JSONArray serializable ? Dear All, I am trying to store a JSONArray into a caching solution that expect the objects to be serializable. JSONArray doesn't seem to implement serializable. Is there any way to store JSONArray or JSONObject into a cache that expect them to be serializable ? Thank you Regards Jeyaram |
From: Jeyaram G. <jey...@gm...> - 2008-12-14 23:07:28
|
Dear All, I am trying to store a JSONArray into a caching solution that expect the objects to be serializable. JSONArray doesn't seem to implement serializable. Is there any way to store JSONArray or JSONObject into a cache that expect them to be serializable ? Thank you Regards Jeyaram |
From: Tom N. <tmn...@gm...> - 2008-12-09 16:39:15
|
Awesome! When can we expect to see it pushed to Maven? On Tue, Dec 9, 2008 at 1:45 AM, Andres Almiray <aal...@ya...> wrote: > Dear users, > I'm pleased to announce that Json-lib version 2.2.3 has been released. > > Download | Documentation | Faq | Changes > > JSON-lib is a java library for transforming beans, maps and XML to JSON and > back again to beans and DynaBeans. It is based on the work by Douglas > Crockford in http://www.json.org/java. > > Changelog: > > 2270596 JSONUtils not thread safe > 2383773 Array of Maps with null key causes exception > 2408679 JsonSlurper.parse(Reader) does not work correctly. Thanks to Tom > Nichols (provided testcase) > 2140653 JavaScript functions as quoted strings in values > 2063201 Infinite loop in JSONArray._fromJSONTokener > 2020482 Performance improvement for JSONUtils.quote Thanks to Peter Schubert > (provided a patch) > 1969942 Excludes should allow for exclusions based on class > 1996038 JSONArray and ListIterator > 1996152 Define reverse PropertyNameProcessor > 2005661 Add class name to skipped properties messages > |
From: Andres A. <aal...@ya...> - 2008-12-09 06:45:53
|
Dear users, I'm pleased to announce that Json-lib version 2.2.3 has been released. Download | Documentation | Faq | Changes JSON-lib is a java library for transforming beans, maps and XML to JSON and back again to beans and DynaBeans. It is based on the work by Douglas Crockford in http://www.json.org/java. Changelog: * 2270596 JSONUtils not thread safe * 2383773 Array of Maps with null key causes exception * 2408679 JsonSlurper.parse(Reader) does not work correctly. Thanks to Tom Nichols (provided testcase) * 2140653 JavaScript functions as quoted strings in values * 2063201 Infinite loop in JSONArray._fromJSONTokener * 2020482 Performance improvement for JSONUtils.quote Thanks to Peter Schubert (provided a patch) * 1969942 Excludes should allow for exclusions based on class * 1996038 JSONArray and ListIterator * 1996152 Define reverse PropertyNameProcessor * 2005661 Add class name to skipped properties messages |
From: Tom N. <tmn...@gm...> - 2008-12-08 20:47:41
|
I skirted around the issue by doing the following: new JsonSlurper().parseText( DefaultGroovyMethods.getText( reader ) ) since that's basically what you're doing anyway :) I should mention that StringBuilder should be (a little) faster than StringBuffer too since it's not synchronized. You don't need the thread-safe implementation there because it's a method-scoped field. Or... I guess you need to use it for backwards-compatibility since StringBuilder was introduced in 1.5... right? Thanks Andres! On Mon, Dec 8, 2008 at 3:16 PM, Andres Almiray <aal...@ya...> wrote: > Thanks Tom! > > Will be taking care of this issue shortly. > > 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: Tom Nichols <tmn...@gm...> > To: jso...@li... > Sent: Monday, December 8, 2008 12:12:01 PM > Subject: [json-lib-user] Bug in JsonSlurper.parse(Reader) > > When I use: > new JsonSlurper().parse( someReader ); > it looks like it is mangling the data and usually throws a parsing error. > > Test case is attached. Tested against json-lib v2.2.2 > > Thanks! > > |
From: Andres A. <aal...@ya...> - 2008-12-08 20:17:02
|
Thanks Tom! Will be taking care of this issue shortly. 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: Tom Nichols <tmn...@gm...> To: jso...@li... Sent: Monday, December 8, 2008 12:12:01 PM Subject: [json-lib-user] Bug in JsonSlurper.parse(Reader) When I use: new JsonSlurper().parse( someReader ); it looks like it is mangling the data and usually throws a parsing error. Test case is attached. Tested against json-lib v2.2.2 Thanks! |
From: Tom N. <tmn...@gm...> - 2008-12-08 20:12:05
|
When I use: new JsonSlurper().parse( someReader ); it looks like it is mangling the data and usually throws a parsing error. Test case is attached. Tested against json-lib v2.2.2 Thanks! |
From: Brec C. <br...@6s...> - 2008-11-05 21:14:04
|
The version of the original code that I have from json.org was not marked as final. It's possible I'm using an out of data but I don't think so judging by the current source up online (http://json.org/java/org/json/JSONObject.java ). Using the serialization options is a way to solve the problem but not the only way. Not only that, if there's no value in converting the data from the json object to a bean or POJO then being forced to do it is simply a waste. This would be the case in my situation, I would gain nothing from serializing the data except the addition cost of de- serializing it later. If the data your modeling is naturally a Map (or list) and your input / outputs are both JSON formatted strings then building your entities as extensions of JSONObject is just very clean. Basically you already have your Map structure taken care of and you can simply fill in gaps in the interfaces to your classes. This is, I realize, not a very big deal. I hate to nitpick on it; it simply caught me off guard yesterday. Consider the above food for thought. Thanks for the reply. Brec Carson On Nov 5, 2008, at 3:40 PM, Andres Almiray wrote: > Brec, > > JSONObject is final because it follows the design of the original > code (json.org), I believe you're the first one encountering > frustration because of this decision (which is not final, no pun > intended). Why would you be required to create wrappers for > JSONObject instances in the first place? aren't the serialization > options provided by the library enough to get you up to speed? > > 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: Brec Carson <br...@6s...> > To: jso...@li... > Sent: Tuesday, November 4, 2008 2:12:47 PM > Subject: [json-lib-user] why is JSONObject declared as final? > > Why is JSONObject declared as final? > > I just "upgraded" to this json library from it's root library. A > decision that was forced on me by virtue of using couchdb4j (no > offense meant to couchdb4j, that library seems perfectly well designed > and I think also frustrated by this design decision in the json-lib). > I am immediately met w/ the frustration of needing to completely > redesign my entities to be dumb wrappers around a JSONObject instead > of an intuitive extension of one. What gives? I can think of no good > reason for this. As this is a trivial change to make, is there any > hope that a new build can be put out for this? From my previous > experience dealing with open source I already know that I'm shouting > at the rain here and it won't do me any good but I still feel the need > to do it. Sorry for the mini-rant. > > Brec Carson > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's > challenge > Build the coolest Linux based applications with Moblin SDK & win > great prizes > Grand prize is a trip for two to an Open Source event anywhere in > the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > json-lib-user mailing list > jso...@li... > https://lists.sourceforge.net/lists/listinfo/json-lib-user > > |
From: Andres A. <aal...@ya...> - 2008-11-05 20:40:09
|
Brec, JSONObject is final because it follows the design of the original code (json.org), I believe you're the first one encountering frustration because of this decision (which is not final, no pun intended). Why would you be required to create wrappers for JSONObject instances in the first place? aren't the serialization options provided by the library enough to get you up to speed? 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: Brec Carson <br...@6s...> To: jso...@li... Sent: Tuesday, November 4, 2008 2:12:47 PM Subject: [json-lib-user] why is JSONObject declared as final? Why is JSONObject declared as final? I just "upgraded" to this json library from it's root library. A decision that was forced on me by virtue of using couchdb4j (no offense meant to couchdb4j, that library seems perfectly well designed and I think also frustrated by this design decision in the json-lib). I am immediately met w/ the frustration of needing to completely redesign my entities to be dumb wrappers around a JSONObject instead of an intuitive extension of one. What gives? I can think of no good reason for this. As this is a trivial change to make, is there any hope that a new build can be put out for this? From my previous experience dealing with open source I already know that I'm shouting at the rain here and it won't do me any good but I still feel the need to do it. Sorry for the mini-rant. Brec Carson ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ json-lib-user mailing list jso...@li... https://lists.sourceforge.net/lists/listinfo/json-lib-user |
From: Brec C. <br...@6s...> - 2008-11-04 22:12:55
|
Why is JSONObject declared as final? I just "upgraded" to this json library from it's root library. A decision that was forced on me by virtue of using couchdb4j (no offense meant to couchdb4j, that library seems perfectly well designed and I think also frustrated by this design decision in the json-lib). I am immediately met w/ the frustration of needing to completely redesign my entities to be dumb wrappers around a JSONObject instead of an intuitive extension of one. What gives? I can think of no good reason for this. As this is a trivial change to make, is there any hope that a new build can be put out for this? From my previous experience dealing with open source I already know that I'm shouting at the rain here and it won't do me any good but I still feel the need to do it. Sorry for the mini-rant. Brec Carson |
From: Chad S. <goo...@gm...> - 2008-09-30 15:01:43
|
I've recently been interested in couchdb and the java library to access it couchdb4j which uses json-lib to create it's JSON messages, which is how clients communicate to the server. Couchdb uses "views" instead of queries. These views return objects via a javascript function that the designer defines. These JavaScript functions are encoded into JSON messages and sent to the server when the view is defined. couchdb4j was unable to create a view because when the javascript function is added to a JSONObject, json-lib converts that string to a function (no quotes). As a result couchdb's JSON decoder receives the unquoted function where it is expecting a string and it fails. In the process of figuring this out, I also noticed that http://www.jsonlint.com/ doesn't consider values of non-quoted functions valid JSON. Of course I have no idea who made that site or what authority they have, but I suppose it's worth mentioning. I was able to modify the behavior by changing this method so that it always returns false. Upon doing this, couchdb4j was able to interact with couchdb properly. JSONUtils.java:286 public static boolean isFunction( Object obj ) { //if( obj instanceof String ){ // String str = (String) obj; // return str.startsWith( FUNCTION_PREFIX ) && FUNCTION_MACTHER.matches( str ); //} //if( obj instanceof JSONFunction ){ // return true; //} return false; } I think it's good for couchdb4j have a non-modified versions of json-lib as it's dependency, so I'm asking if there is a way in which the functionality I need (JavaScript functions as quoted strings in values) can be made available through json-lib. Thanks, -- Chad Skeeters 1-210-881-0453 |
From: Andres A. <aal...@ya...> - 2008-08-13 16:35:06
|
Vadim, You can't transform a Collection into a JSONObject. Collections and arrays can only be transformed into JSONArray Regards, 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. ----- Original Message ---- From: Vadim <dea...@gm...> To: jso...@li... Sent: Wednesday, August 13, 2008 2:47:54 AM Subject: [json-lib-user] Convert collection of beans to json Hello, I've been trying to solve this for couple of hours now. I need to transform Collection<Vehicle> to JSONObject, where Vehicle (id = 1, regNr = 2) -> JSONObject.toString() == "{'id':'1', 'regNr':'2'}" {Vehicle (id = 1, regNr = 2), Vehicle (id = 2, regNr = 6)} -> JSONObject.toString() == "{'id':'1,2', 'regNr':'2,6'}" (not "{'id':'1', 'regNr':'2'}, {'id':'2', 'regNr':'6'}") JSONSerializer.fromObject(Collection) returns an array of separate objects transformed to JSON ("{'id':'1', 'regNr':'2'}, {'id':'2', 'regNr':'6'}"). Of course I could do the needed transformation by hand, but I'm sure there's something in the API that I'm missing. |
From: Vadim <dea...@gm...> - 2008-08-13 09:47:57
|
Hello, I've been trying to solve this for couple of hours now. I need to transform Collection<Vehicle> to JSONObject, where Vehicle (id = 1, regNr = 2) -> JSONObject.toString() == "{'id':'1', 'regNr':'2'}" {Vehicle (id = 1, regNr = 2), Vehicle (id = 2, regNr = 6)} -> JSONObject.toString() == "{'id':'1,2', 'regNr':'2,6'}" (not "{'id':'1', 'regNr':'2'}, {'id':'2', 'regNr':'6'}") JSONSerializer.fromObject(Collection) returns an array of separate objects transformed to JSON ("{'id':'1', 'regNr':'2'}, {'id':'2', 'regNr':'6'}"). Of course I could do the needed transformation by hand, but I'm sure there's something in the API that I'm missing. |
From: Andres A. <aal...@ya...> - 2008-08-06 17:43:30
|
Hi Peter, Json-lib should honor numbers and booleans, if it is rendering them as strings there is probably something wrong. Could you share your test code? also which version are you testing with? Arbitrary javascript code is not allowed, i.e. {“dateLong”: new Date(123456789)} due to the JSON spec 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. ----- Original Message ---- From: Peter Wilkinson <Pet...@ig...> To: jso...@li... Sent: Wednesday, August 6, 2008 9:35:20 AM Subject: [json-lib-user] Have JSON values as something other than strings Hi all, I’m new to playing with json-lib but it looks pretty handy. One query though. I’ve noticed that if I have an object with Booleans, numbers and strings the json that comes out only contains strings. e.g. int i = 3; boolean bool = false; long dateLong = 123456786; String str = “str”; goes to {“i” : “3”, “bool” : “false”, “dateLong”: “123456789”, “str” : “str”} Is it possible to make it give me {“i” : 3, “bool” : false, “dateLong”: new Date(123456789) , “str” : “str”}} Cheers, Peter The information contained in this email is strictly confidential and for the use of the addressee only, unless otherwise indicated. If you are not the intended recipient, please do not read, copy, use or disclose to others this message or any attachment. Please also notify the sender by replying to this email or by telephone (+44 (0)20 7896 0011) and then delete the email and any copies of it. Opinions, conclusions (etc.) that do not relate to the official business of this company shall be understood as neither given nor endorsed by it. IG Index plc is a company registered in England and Wales under number 01190902. VAT registration number 761 2978 07. Registered Office: Friars House, 157-168 Blackfriars Road, London SE1 8EZ. Authorised and regulated by the Financial Services Authority. FSA Register number 114059. |
From: Peter W. <Pet...@ig...> - 2008-08-06 16:35:28
|
Hi all, I'm new to playing with json-lib but it looks pretty handy. One query though. I've noticed that if I have an object with Booleans, numbers and strings the json that comes out only contains strings. e.g. int i = 3; boolean bool = false; long dateLong = 123456786; String str = "str"; goes to {"i" : "3", "bool" : "false", "dateLong": "123456789", "str" : "str"} Is it possible to make it give me {"i" : 3, "bool" : false, "dateLong": new Date(123456789) , "str" : "str"}} Cheers, Peter The information contained in this email is strictly confidential and for the use of the addressee only, unless otherwise indicated. If you are not the intended recipient, please do not read, copy, use or disclose to others this message or any attachment. Please also notify the sender by replying to this email or by telephone (+44 (0)20 7896 0011) and then delete the email and any copies of it. Opinions, conclusions (etc.) that do not relate to the official business of this company shall be understood as neither given nor endorsed by it. IG Index plc is a company registered in England and Wales under number 01190902. VAT registration number 761 2978 07. Registered Office: Friars House, 157-168 Blackfriars Road, London SE1 8EZ. Authorised and regulated by the Financial Services Authority. FSA Register number 114059. |