Skip to content

What differs Javascript object from JSON

Last updated on January 18, 2020

Sometimes, we might get stuck into identifying which one is the javascript object and JSON. Since both look very similar but there is a subtle difference. As a junior developer from my team at the starting point of time, I also faced the same issue.

Let’s check with an example, the below one is Javascript object

{
 "name": "SrinivasanKK",                
 "isExecuted": false,
 "topic": "JavaScript"
}
JSON would be,

"{
 "name": "SrinivasanKK",                
 "isExecuted": false,
 "topic": "JavaScript"
 }"

Both key & value pairs should be surrounded by a quote, called as “JSON“. You can not use Javascript object directly for JSON instead, use JSON.stringify(<js-object>).

If you feel something to be added for more info, go ahead and mention in comments. I value your time and effort making this post super useful for beginners.

Published inJavaScript