TOP 15 JSON Interview Questions & Answers

JSON stands for JavaScript Object Notation. The JSON is a simple data exchange format. The JSON it is also language and platform independent. In other words, JSON is a lightweight text-based open standard designed for human-readable data inheritance. Here I am going share a list of JSON interview questions & answers for freshers and experienced. This list of JSON questions will help you to crack your next JSON job interview.

Question: What is JSON? For what is used for?

JSON (JavaScript Object Notation) is a data storage and communication format based on key-value pair of JavaScript object literals. It is a lightweight text-based open standard designed for human-readable data interchange which is derived from the JavaScript programming language for representing simple data structures and

Question: Explain what is JSON objects?

An object can be defined as an unordered set of name/value pairs. An object in JSON starts with {left brace} and finish or ends with {right brace}. Every name is followed by: (colon) and the name/value pairs are parted by, (comma).

Question: What programming languages supported by JSON?

JSON is a text format that is completely language independent but uses conventions that are familiar to programmers of the C-family of languages, including C, C++, C#, Java, JavaScript, Perl, Python, and many others.

Question: Explain how to work JSON with php?

The JSON is so easy with php. There is no installation needed to use these functions. They are part of the core php. The JSON with php use three php function is:

  • json_encode(): To get JSON dispaly of a value.
  • json_decode(): This function is used for Decodes a JSON string.
  • json_last_error(): This function is used for to get the last error occurred in the process.

Question: How to convert Javascript objects into JSON?

JSON.stringify(value); is used to convert Javascript objects into JSON.

    var obj={"website":"Onlineinterviewquestions"};
    JSON.stringify(obj); // '{"website":"Onlineinterviewquestions"}'

Question: Why must one use JSON over XML?

  • It is faster and lighter than XML as on the wire data format
  • XML data is typeless while JSON objects are typed
  • JSON types: Number, Array, Boolean, String
  • XML data are all string
  • Data is readily available as JSON object is in your JavaScript
  • Fetching values is as simple as reading from an object property in your JavaScript code

Question: Is JSON is a language?

JSON is a data format. It could be classified as a language, but not a programming language. Its relationship to JavaScript is that it shares its syntax (more or less) with a subset of JavaScript literals.

Question: What is JSON data?

JSON, or JavaScript Object Notation, is a minimal, readable format for structuring data. In JSON data is nothing but a information. It is used primarily to transmit data between a server and web application, as an alternative to XML.

Question: Explain what is a JSON-RPC Parser?

JSON Parser: The JSON Parser is used for to parse JSON data into objects to use its value. It can be also parsed by the JavaScript, jQuery and PHP.

JSON RPC: The JSON RPC is a simple remote procedural call protocol similarly XML-RPC although it also uses the lightweight JSON format instead of XML.

Question: What is JSON Value?

A JSON value can be an object, array, number, string, true, false, or null.

Question: Who is the father of JSON?

The father of JSON is Douglas Crockfrord.

Question: What does $.parseJSON() do ?

$.parseJSON() takes a well-formed JSON string and returns the resulting JavaScript value.

Question: What is the default value of a constructor’s prototype?

A plain, empty object that derives from Object.prototype is the default value of a constructor’s prototype

Question: What is JSON Array?

An array structure is a pair of square bracket tokens surrounding zero or more values. An array is an ordered collection of values. An array begins with [ (left bracket) and ends with ] (right bracket). Values are separated by , (comma).

The values are separated by commas. The JSON syntax does not define any specific meaning to the ordering of the values. However, the JSON array structure is often used in situations where there is some semantics to the ordering.

Question: Mention what are the data types supported by JSON?

Data types supported by JSON includes

  • Number
  • String
  • Boolean
  • Array
  • Object
  • Null

Question: What is the difference between JSON and JSONP?

  • JSON: JSON is a simple data format used for communication medium between different systems
  • JSONP: It is a methodology for using that format with cross-domain ajax requests while not being affected by same origin policy issue.

Question: Mention what are the JSON files?

  • JSON file type for JSON files is “.json”
  • The MIME type for JSON text is “application/json”

Question: What is BSON?

BSON is the superset of JSON, which used by MongoDB.BSON supports the embedding of documents and arrays within other documents and arrays. BSON also contains extensions that allow representation of data types that are not part of the JSON spec.

Question: What are the limitations of JSONP?

JSONP is used to bypass the same-origin policy of web browsers. It may seem like a perfect way to get around the restriction but it has its own set of limitations as well. They are:

  • As all the JSONP calls are made by including a <script> tag, the request made is confined only to the GET method.
  • It cannot be used for POST or PUT requests.
  • It can be used only for read-only services and APIs.