Java Reference
In-Depth Information
how straightforward it is to request and consume Web service data in both JSON
and XML formats. First, let's take a closer look at the details of JSON.
JavaScript Object Notation (JSON)
With the emergence of dynamic Web-based applications based on Asynchronous
JavaScript and XML (Ajax) technology, JavaScript Object Notation (JSON)
became a popular alternative to XML. This is mainly because JSON tends to be
smaller and more readable than XML, making it both more efficient to send over
the Internet uncompressed, and more convenient to work with. Although it's
closely associated with JavaScript—in fact it's a subset—in practice it's lan-
guage independent.
There are JSON parsers available for most of the popular languages, including
C++, Java, Perl, Python, and now JavaFX. JSON's basic object types, which map
very well to both Java and JavaFX types, are
String . A Unicode text string of characters enclosed in double quotes, with
backslash escaping.
Number . An integer, real, or floating-point numeric value.
Boolean . A flag that contains a true or false value.
Object . A collection of associated data, represented as key:value pairs, sepa-
rated by commas, and grouped together with curly braces. For example:
"author": {
"last": "Bruno",
"first": "Eric",
"book": "JavaFX: Developing Rich Internet Applications",
"ISBN": 013701287X,
"yearPublished": 2009,
"publisher": "Pearson"
}
Array . An ordered pair of comma-separated values grouped together with
square braces. For example:
"authors": [
"Clarke",
"Connors",
"Bruno"
]
 
Search WWH ::




Custom Search