Re: JsonRepresentation(JSONArray jsonArray) Not working
Hi Daniel, The fix is part of Restlet 1.1.1. I've done a test with SVN trunk (Restlet 1.2 snapshot) and it worked: JSONArray jsonFeedEntry = new JSONArray(); jsonFeedEntry.put("Red"); jsonFeedEntry.put("Blue"); System.out.println("VALUES:"+jsonFeedEntry.toString()); Representation jr = new JsonRepresentation(jsonFeedEntry); jr.write(System.out); returns: VALUES:["Red","Blue"] ["Red","Blue"] Could you try to code above with Restlet 1.1.1 and let me know if it works? Best regards, Jerome Louvel -- Restlet ~ Founder and Lead developer ~ http://www.restlet.org Noelios Technologies ~ Co-founder ~ http://www.noelios.com -Message d'origine- De : Daniel Woo [mailto:daniely...@hotmail.com] Envoye : vendredi 9 janvier 2009 19:40 A : discuss@restlet.tigris.org Objet : Re: JsonRepresentation(JSONArray jsonArray) Not working In Restlet 1.1.1 the result is still {"class":"class org.json.JSONArray"} which version or patch you will have it? So far, it's a little clumsy to query a list of resources like /rest/cars without JSONArray -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=1014190 -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=1023930
RE: Re: JsonRepresentation(JSONArray jsonArray) Not working
In Restlet 1.1.1 the result is still {"class":"class org.json.JSONArray"} which version or patch you will have it? So far, it's a little clumsy to query a list of resources like /rest/cars without JSONArray -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=1014190
RE: Re: JsonRepresentation(JSONArray jsonArray) Not working
And I think json-lib is better than json.org, I use json-lib to convert json with xml, while json.org cannot do that. -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=1014213
Re: JsonRepresentation(JSONArray jsonArray) Not working
Hello Adrian, this bug has been fixed. You can check out the svn repsitory or wait for the incoming snapshot (tomorrow). best regards, Thierry Boileau Hello, we are testing the following code in a Java class" JSONArray jsonFeedEntry = new JSONArray(); jsonFeedEntry.put("Red"); jsonFeedEntry.put("Blue"); System.out.println("VALUES:"+jsonFeedEntry.toString()); result = new JsonRepresentation(jsonFeedEntry); It seems to print out the proper information but nothing is being returned in the result for some reason. If we change the same code and add the following, it works fine with the JSONObject: JSONObject jsonobj = new JSONObject(); jsonobj.put("id","ID.."); jsonobj.put("name", "NAME..."); result = new JsonRepresentation(jsonobj); Any reason or documentation on how to get it working properly with the JSONArray class? Thanks. Adrian
Re: JsonRepresentation(JSONArray jsonArray) Not working
Hello Adrian, as a workaround, you can instantiate the JSonRepresentation as follow: result = new JsonRepresentation(jsonFeedEntry.toString()); I've created an RFC for this issue => http://restlet.tigris.org/issues/show_bug.cgi?id=645 The fix will come soon. best regards, Thierry Boileau Hello, we are testing the following code in a Java class" JSONArray jsonFeedEntry = new JSONArray(); jsonFeedEntry.put("Red"); jsonFeedEntry.put("Blue"); System.out.println("VALUES:"+jsonFeedEntry.toString()); result = new JsonRepresentation(jsonFeedEntry); It seems to print out the proper information but nothing is being returned in the result for some reason. If we change the same code and add the following, it works fine with the JSONObject: JSONObject jsonobj = new JSONObject(); jsonobj.put("id","ID.."); jsonobj.put("name", "NAME..."); result = new JsonRepresentation(jsonobj); Any reason or documentation on how to get it working properly with the JSONArray class? Thanks. Adrian
JsonRepresentation(JSONArray jsonArray) Not working
Hello, we are testing the following code in a Java class" JSONArray jsonFeedEntry = new JSONArray(); jsonFeedEntry.put("Red"); jsonFeedEntry.put("Blue"); System.out.println("VALUES:"+jsonFeedEntry.toString()); result = new JsonRepresentation(jsonFeedEntry); It seems to print out the proper information but nothing is being returned in the result for some reason. If we change the same code and add the following, it works fine with the JSONObject: JSONObject jsonobj = new JSONObject(); jsonobj.put("id","ID.."); jsonobj.put("name", "NAME..."); result = new JsonRepresentation(jsonobj); Any reason or documentation on how to get it working properly with the JSONArray class? Thanks. Adrian