JSON (JavaScript Object Notation) is a lightweight, language-independent, text-based data storage and data-interchange format to sharing between systems.
Below are some properties make JSON an ideal data-interchange language:
- JSON is “self-describing” and easy for humans to read and write.
- JSON is text, written with JavaScript object notation.
- JSON represent values in form of key/value pairs.
- JSON is easy for API’s to parse and generate.
- JSON is a text format that is supported by many languages because of language-independent
Points to remember
The JSON file extension is “.json”
The JSON text MIME type is “application/json”.
Why use JSON?
There are so many reasons to use JSON:
- JSON represents values in form of key/value pairs which is easy to understand and supported by most programming languages For Ex: C, C++, C#, Java, JavaScript, Perl, Python, and many others.
- The JSON format is text, it can easily exchange browser to and from a server,
- Current enterprise application uses JSON for communications to the server with REST services, Communication to the server with Ajax call, convert Javascript object to JSON or vice versa.
- JSON extensively used by NoSQL database to store records as JSON documents. For Ex: MongoDB, Oracle NoSQL Database, and Oracle Berkeley DB.
- Traditional relational databases constantly gaining more JSON capabilities like PostgreSQL, Oracle, etc. supports JSON data for certain features such as transactions, indexing, declarative querying, and views.
JSON Example
You can refer below JSON object to represent Student Detail. Corresponding is a description of the representation of each field in JSON with respect to the data type.
Above JSON is generated with respect to below Student JAVA object. You can follow below link to know about JSON supported Data Type and Syntax.
The same Student and JSON object will refer in the subsequent example related to JAVA for more JSON + JAVA handling example.
JAVA JSON API’s
Below is the list of the library that developed by java open source community to handle (JAVA +JSON) development.
- JACKSON
- GSON
- Boon
- JSON.org
Follow below link to know in-depth knowledge of JSON parsers and in which case should be used specifically.
You would like to see
Follow below link to learn more on JSON and JSON issues solutions: