What is the difference between JSON and Object Literal Notation?

Posted by burak ozdogan on Stack Overflow See other posts from Stack Overflow or by burak ozdogan
Published on 2010-05-25T11:34:30Z Indexed on 2010/05/25 11:41 UTC
Read the original article Hit count: 351

Filed under:
|
|

Hi,

Can someone tell me what is the main difference between a Javascript object defined by using "Object Literal Notation" and JSON object?

According to a Javascript book it says this is an object defined by using Object Notation:

var newObject =
{
    prop1 : true,
    showMessage : function (msg) {alert(msg)}
};

Why it is not a JSON object in this case? Just because it is not defined by using quotation marks?

Thanks,

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about JSON