Your SlideShare is downloading. ×
0
Comparing JSON Libraries - July 19 2011
Comparing JSON Libraries - July 19 2011
Comparing JSON Libraries - July 19 2011
Comparing JSON Libraries - July 19 2011
Comparing JSON Libraries - July 19 2011
Comparing JSON Libraries - July 19 2011
Comparing JSON Libraries - July 19 2011
Comparing JSON Libraries - July 19 2011
Comparing JSON Libraries - July 19 2011
Comparing JSON Libraries - July 19 2011
Comparing JSON Libraries - July 19 2011
Comparing JSON Libraries - July 19 2011
Comparing JSON Libraries - July 19 2011
Comparing JSON Libraries - July 19 2011
Comparing JSON Libraries - July 19 2011
Comparing JSON Libraries - July 19 2011
Comparing JSON Libraries - July 19 2011
Comparing JSON Libraries - July 19 2011
Comparing JSON Libraries - July 19 2011
Comparing JSON Libraries - July 19 2011
Comparing JSON Libraries - July 19 2011
Comparing JSON Libraries - July 19 2011
Comparing JSON Libraries - July 19 2011
Comparing JSON Libraries - July 19 2011
Comparing JSON Libraries - July 19 2011
Comparing JSON Libraries - July 19 2011
Comparing JSON Libraries - July 19 2011
Comparing JSON Libraries - July 19 2011
Comparing JSON Libraries - July 19 2011
Comparing JSON Libraries - July 19 2011
Comparing JSON Libraries - July 19 2011
Comparing JSON Libraries - July 19 2011
Comparing JSON Libraries - July 19 2011
Comparing JSON Libraries - July 19 2011
Comparing JSON Libraries - July 19 2011
Comparing JSON Libraries - July 19 2011
Comparing JSON Libraries - July 19 2011
Comparing JSON Libraries - July 19 2011
Comparing JSON Libraries - July 19 2011
Comparing JSON Libraries - July 19 2011
Comparing JSON Libraries - July 19 2011
Comparing JSON Libraries - July 19 2011
Comparing JSON Libraries - July 19 2011
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Comparing JSON Libraries - July 19 2011

11,872

Published on

Comparing JSON Lib

Comparing JSON Lib

Published in: Technology, Education
0 Comments
7 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
11,872
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
103
Comments
0
Likes
7
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. ComparingJSON libraries Sean Sullivan Portland Java User Group July 19, 2011
  • 2. JavaScript Object Notation
  • 3. { “hello” : “world”, “count” : 1 }pentagon hexagon json
  • 4. JSON is a data interchange format
  • 5. { “name” : “Mock Crest Tavern”, “tags” : [ “music”, “beer”, “tots” ], “location” : { “city” : “Portland”, “state” : “Oregon” }}
  • 6. JSON• based on a subset of the JavaScript programming language• text format• language independent
  • 7. RFC 4627
  • 8. How is JSON useful to Java developers?
  • 9. Web Services
  • 10. “In the first version of our API, data was available in XML, with JSON support added largely as an afterthought. XML as a means for delivering developer-friendly data hasn’t aged well. Seeing the growing inclination of developers and API makers alike towards JSON, we’ve decided to eliminate XML support and put the energy spent there into getting our JSON implementation just right.” July 2011http://engineering.tumblr.com/post/7541361718/introducing-tumblrs-new-api
  • 11. JSON libraries• json.org library• Google GSON• Jackson• lift-json
  • 12. http://json.org/javadoc
  • 13. import org.json.*;JSONObject obj = new JSONObject();obj.put(“Hello”, “World”);obj.put(“count”, 1);String json = obj.toString();
  • 14. http://jackson.codehaus.org/
  • 15. import org.codehaus.jackson.*;import org.codehaus.jackson.map.*;ObjectMapper mapper = new ObjectMapper();String json = mapper.writeValueAsString(foo);Foo foo2 = mapper.readValue(json, Foo.class);
  • 16. http://code.google.com/p/google-gson/
  • 17. import com.google.gson.*;GsonBuilder builder = new GsonBuilder();Gson gson = builder.create();String json = gson.toJson(foo);Foo foo2 = gson.fromJson(json, Foo.class);
  • 18. Jackson vs GSON• GSON serializes all non-transient non- static fields. GSON accesses fields directly with Java’s Reflection API• Jackson uses JavaBean methods (setter methods / getter methods)
  • 19. JSON and Scala
  • 20. lift-json
  • 21. JSON and Android
  • 22. JsonReader, json.org JsonWriterAndroid 1.x Y NAndroid 2.x Y NAndroid 3.x Y Y
  • 23. Benchmarks
  • 24. Related topics
  • 25. Native JSONhttp://blogs.msdn.com/ie/archive/2008/09/10/native-json-in-ie8.aspxhttp://blog.mozilla.com/webdev/2009/02/12/native-json-in-firefox-31/
  • 26. For more information• http://www.json.org• http://en.wikipedia.org/wiki/JSON
  • 27. Thank you

×