DEV Community

Raisan JMR
Raisan JMR

Posted on

What is JSON

JSON which is popularly known as javascript object notation, it is a text format used to transfer data from server to client in plain text format.

the format of json is similar to javascript objects.

here is how javascript object looks like:

code 1

next we are going to convert this person object to JSON using a method called JSON.parse()

code 2

the output looks like plain text. and that is called JSON data

{"firstName":"John","lastName":"Doe","age":17,"address":{"city":"abc city","street":"abc street"}}
Enter fullscreen mode Exit fullscreen mode

to convert back this JSON data to string we should use a method called JSON.stringify() and pass person object to it

there is an amazing website called https://jsonlint.com/ to test our json code

Top comments (0)