concept JSON in category java

appears as: JSON
Making Java Groovy: Foreword by Guillaume Laforge

This is an excerpt from Manning's book Making Java Groovy: Foreword by Guillaume Laforge.

3.  Groovy makes working with XML and JSON easy. Here’s an area where Groovy shines. Groovy includes classes called MarkupBuilder, which makes it easy to generate XML, and JsonBuilder, which produces JSON objects. It also has classes called XmlParser and XmlSlurper, which convert XML data structures into DOM structures in memory, and JsonSlurper, to parse JSON data. These will be used throughout the book, especially in chapter 9 on RESTful web services.

The trend in the industry has been away from XML and toward JavaScript Object Notation, known as JSON. If your client is written in JavaScript, JSON is a natural, because JSON objects are native to the language. Java doesn’t include a JSON parser, but several good libraries are available.

Spring Roo in Action

This is an excerpt from Manning's book Spring Roo in Action.

Configuring JSON

The rest of the script concerns the web interface. Roo can optionally expose JSON to the web tier if needed. These commands provide JSON support for the web services we reviewed earlier:

GWT in Practice

This is an excerpt from Manning's book GWT in Practice.

GWT intentionally keeps things very basic and optimizes the translation of data from Java to JavaScript and vice versa. While this mechanism is really easy to work with and to understand, it’s a GWTism. That is to say, GWT does not use a standard or existing idiomatic approach—no XML-RPC, SOAP, or REST is involved. But despite using its own approach, GWT can also communicate with existing services in additional ways to facilitate integration, such as using plain XML over HTTP (POX), or JSON. These are additional methods, though; the native mechanism for GWT client-server communication is GWT RPC.

Listing 5.8. Retrieving and parsing JSON

While JSON is fairly popular with the Web 2.0 set, you may not have any of your services exposed as JSON if you’re working in an enterprise environment. The more likely candidate there is SOAP, since it forms the basis of the WS-* specifications that are all the rage within the enterprise computing community. To that end, we’ll look at options for accessing SOAP from GWT in the next two sections, and at the advantages and disadvantages of various approaches.