JSON - Java's Son

JSON stands for JavaScript Object Notation. It is a lightweight data-interchange format.

  • JSON is based on a subset of the JavaScript Programming Language Standard ECMA-262 3rd Edition - December 1999.
  • JSON is a lightweight format for store and transporting data.
  • JSON is often used when data is sent from a server to web page
  • JSON is easy to understand as compared to XML

In JSON, values must be one of the following data types:

  1. String
  2. Number
  3. Boolean
  4. Array
  5. Object or null

Key and Value are two main parts of the JSON.

  • KEY : A Key is always a text enclosed in quotation marks.
  • VALUE : A value can be a string, number, boolean, expression, array of object.

{
   "name" : "David",
   "company" : "Websoft",
   "online" : true,
   "updated": "2021-12-31T23:28:56.782Z",
   "followers" : 987

},
{
   "name" : "HSWong",
   "company" : "Nestronics",
   "online" : false,
   "updated": "2022-01-29T08:06:33.666Z",
   "followers" : 2023

}

JSON PARSE

Use the Javascript function JSON.parse() to convert text into javascript object

var obj = JSON.parse('{"name" : "HSWong", "company" : "Nestronics", "followers" : 2023} ');

JSON STRINGIFY

Use the Javascript function JSON.stringify() to convert it into a string and send to a web server

var obj = JSON.parse('{"name" : "HSWong", "company" : "Nestronics", "followers" : 2023} '); const myJSON = JSON.stringify(obj);

Comments

Popular posts from this blog

How to pay bonuses before salary payments

To Enable IIS HTTPS on your website