Now, a days majority of APIs use JSON as a format of data exchange. It has become necessary for an interviewee to prepare for JSON interview questions. Practice the below interview questions to ace your interview easily.
1) What is the full form of JSON?
2) What is the definition of JSON?
3) What is JSON used for?
JSON is used for communication between server side technologies and mobile app or website.
4) What is the file extension of JSON?
The file extension of JSON is .json.
5) What is the rule for writing JSON?
- JSON is the collection of key and value pair separated by the comma.
- Key and value are separated by the colon (:).
- Square brackets are used to store JSON array.
- Curly brackets are used to hold JSON objects.
6) How many data types are there in JSON?
There are six types of data types in JSON -
7) JSON vs. XML?
- XML is heavy and verbose. JSON is short and lightweight.
- File extension of XML data is .xml. File extension of JSON data is .json.
- XML is document based. JSON is data based.
- JSON is simple to read, write and understand. XML is less simple to read, write and understand.
- Array is supported by JSON. Array is not supported by XML.
8) What is MIME type for JSON data?
MIME type is application/json.
9) Which functions are used for encoding and decoding JSON in PHP?
For encoding, json_encode() function is used. This function takes PHP value like array as input and returns JSON representation of it. For decoding, json_decode() function is used. This function takes JSON string as input and returns associative array.
10) What is the use of JSON.stringify() function?
11) What is the purpose of JSON.parse() function?