Is JSON a string?

JSON is just a format and neither a string nor an object. Normally, JSON string is used to exchange data.However to access data,we have to parse or convert the JSON string into a javascript object.

It would be more clear if we look this concept from code itself. The code below is for javascript as of now,although we can use JSON in other languages as well.

/*Lets say server want to send the variable 'a' which is a 
 JSON String*/
a = ‘{“name”:”HELLO”, “age”: 2000}’;

/*When a client want to use this data,first it will have to 
  convert 'JSON string' into an object.We can do that using 
  JSON.parse().in javascript*/

b = JSON.parse(a);

/*Now b become an object and now it is ready to be used and it 
looks like: {name:”HELLO”,age:2000}. Notice properties are not 
quoted anymore like in JSON string above. */
console.log(b["name"]); //this would display HELLO.

JSON is a text-based data format following JavaScript object syntax. JSON exists as a string — useful when you want to transmit data across a network. It needs to be converted to a native JavaScript object when you want to access the data.

This information is taken from the MDN documention, please see it for reference: https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Objects/JSON https://www.w3schools.com/js/js_json_intro.asp


Q: Is JSON a string?

A: No. It is a standard.

We however transmit this format through encoded or raw string over the http protocol, then using API like JSON.parse to create this representation back as key-value paired objects within a process's memory.