![]() |
JSON Interview Question and Answers |
What is JSON?
JSON: JavaScript Object Notation is a tool to exchange data. It is defined as a javascript object. Using JSON we can store javascript Objects as text. When it will be required we can convert text into objects.
Is it possible to have an array of JSON or JSON having the array as values?
Yes, it is possible to do so. We can define a key in JSON having an array as value and we also can define an array having a JSON as value.
What is the use of JSON?
JSON is used to exchange data from the server. Since it is a text string, it is faster than any other format like XML.
What is JSON.parse() ?
JSON.parse() , parse the JSON string and return an full fetured object.
What is JSON.stringify()?
JSON.stringify(), convert the JSON Objects into string.
How can we handle the JSON in PHP?
PHP provides functions to handle the JSON. We can parse JSON using PHP and can convert it into an array. Function we use to convert a JSON to Object is json_decode(); json_decode() convert Javascript Object into PHP object. If we pass second argument in it as “true” it will return an associative array.
What is JSONP?
JSONP is called JSON with Padding. This is used to exchange data on cross sites protocols.