JSON

Available

Prior to the mass adoption of JavaScript, an XML-based data storage and transfer format was popular.

Information about a person in this format could look like this:

<person firstName="Bill" lastName="Gates">
   <birthday day="12" month="10" year="1965">
   <address city="Radmond" state="Washington" street="Gates 1" zipCode="93122">
   <phone home="+123456789" work="+123456799">
</person>

Such code consisted almost entirely of tags and was very convenient for parsing programs. However, it was difficult for people to read such code. Therefore, over time, it began to be replaced by the JSON format, created on the basis of JavaScript objects.

JSON stands for JavaScript Object Notation.

The same object written as JSON would look like this:

{
  "firstName": "Bill",
  "lastName": "Gates",
  "birthday": {
   	"day": "12",
   	"month": "10",
   	"year": "1965" },
  "address": {
   	"city": "Radmond",
   	"state": "Washington",
   	"street": "Gates 1",
   	"zipCode": "93122"},
  "phone": {
    "home": "+123456789",
    "work": "+123456799"}
}

Such a record is more difficult for a computer, but easier for a person. With the rise of the Internet and JavaScipt in particular, this format has supplanted all others. In addition, fast JSON data parser libraries were written.

Java has libraries that can convert Java objects to and from JSON. So as a Java programmer, you have nothing to worry about.

In addition, with JDK 7, Java introduced a built-in data type - JsonObject. You can read more about it in the documentation .

Comments
  • Popular
  • New
  • Old
You must be signed in to leave a comment
This page doesn't have any comments yet