Json serialization

20 views
Skip to first unread message

Facundo Schwindt

unread,
Sep 18, 2011, 7:53:21 PM9/18/11
to google-we...@googlegroups.com

Hi everyone ...

This days I was surfing different method to serialize and deserialize Json.
I found Piriti ( http://code.google.com/p/piriti/ ) this run on the client side only.

but I try to reproduce an example of the wiki with no good results.  http://code.google.com/p/piriti/wiki/Json#Implementation

Any one knows where really I have to put the JSON data of this example in a GWT project? :

JSON data 
{
   
"isbn": "978-0345417954",
   
"pages": 432,
   
"title": "The Hotel New Hampshire",
   
"author": {
       
"firstname": "John",
       
"surname": "Irving",
   
},
   
"reviews": [
       
"A hectic gaudy saga with the verve of a Marx Brothers movie.",
       
"Rejoice! John Irving has written another book according to your world.",
       
"Spellbinding, intensely human, a high-wire act of dazzling virtuosity."
   
]
}     


and how a do for that example works on my gwt project ?

Thanks
Ezequiel

Harald Pehl

unread,
Sep 19, 2011, 4:52:38 AM9/19/11
to google-we...@googlegroups.com
You have different options for loading / parsing JSON data: 
  1. Receive it as a string from the server as a result of a RCP / REST call. Therefore Pirit was originally intended.
  2. Load it from an external file. I'm using this option in my unit tests. See http://code.google.com/intl/de-DE/webtoolkit/doc/latest/DevGuideClientBundle.html#TextResource for more details.
In any case the JsonReader interface needs the JSON data as string or as JSONObject. See http://piriti.googlecode.com/svn/site/apidocs/name/pehl/piriti/json/client/JsonReader.html

BTW Piriti has its own group: https://groups.google.com/forum/#!forum/piriti. You can also ask questions there.

- Harald

Reply all
Reply to author
Forward
0 new messages