JSON Interview Questions and Answers

Explain what is JSON?

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.

How many languages, including in JSON?

Languages including in JSON are:

  • C
  • C++
  • C#
  • Java
  • JavaScript
  • Perl
  • Python
  • Php

What is the file extension name of JSON?

JSON filename extension is .json.

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.

For example:

\"firstName\": \"Meraj\",
\"lastName\": \"Ansari\",
\"age\": 20,
\"address\": {
\"streetAddress\": \"Allahabad Road Faizabad \",
\"city\": \"Faizabad\",
\"state\": \"Uttar Pradesh\",
\"postalCode\": \"224001\"
\"phoneNumber\": [
{ \"type\": \"home\", \"number\": \"09839810502\" },
$decodeString = json_decode($string);
echo \'First Name - \'.$decode->{\"firstName\"};
echo \'Last Name - \'.$decode->{\"lastName\"};
echo \'Address - \'.$decode->{\"address\"}->{\"streetAddress\"};

Mention how to convert JSON text to a JavaScript object?

Most commonly use of JSON is to collect JSON data from a web server as file or HTTP (Hyper text Markup Language) and convert the JSON data to a JavaScript and then it avails the data in a web page.

What is the rule for JSON syntax rules? Explain with an example of JSON object?

The JSON syntax is a set of the JavaScript object notation syntax are:

  • The curly brackets hold objects
  • A data is in name and value pairs
  • The square bracket holds arrays
  • A data is separated by comma

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.

How to compare JSON with JavaScript?

The JSON is a subset of the object literal notation of JavaScript. The JSON also can be used in the JavaScript language with no muss or fuss.

Who is the father of JSON?

The father of JSON is Douglas Crockfrord.