Json Interview Question and Answer

Q.what is JSON ?

A.JSON stands for JavaScript Object Notation.Json is used to data transfer between server and web application.It does not have end tag and reserved word like XML.Json Internet Media type is "application/json".

Q.Who is Father of JSON?

A.Douglas Crockford is Father of JSON.

Q.why would we use JSON Over XML?

A.It is faster and lighter than XML.
    JSON objects are typed while XML data is typeless.
    XML items must be wrapped in open and close tags whereas JSON you just name the tag once.
    Fetching values is as simple as reading from an object property.

Which function is used to convert a JSON text into an object?

JSON.parse() method is used to parses a string as JSON.

Q.what is the MIME type of JSON?

A."application/json" is MIME type of JSON.

Q.what is JSONP?

A.JSONP as in "JSON with Padding".JSONP is a method commonly used to bypass the cross-domain policies in web browsers.

Q.Define the use of JSON.stringify ?

A.JSON.stringify() method converts a JavaScript value to a JSON string.
    JSON.stringify(value [, replacer] [, space]);

<script type="text/javascript">
var usercontact = new Object();
usercontact.firstname = "Manish";
usercontact.surname = "Mishra";
var jsonText = JSON.stringify(usercontact);
// Output: 
// {"firstname":"Manish","surname":"Mishra"}

Q.what are the drawbacks of JSON?

A.No namespace support, hence poor extensibility.
    Less development tools support as XML.
    We can't use comments in JSON.