Saturday, 10 October 2015

23 - JSON Interview Questions

1.  What is the full form of JSON?
Ans Javascript Object Notation.

2.  What is JSON?
Ans. JSON is text-based human-readable data - interchange format.

3.  Who is the father of JSON?
Ans. Douglas Crockford.

4. How to parse JSON object to Javascript object?
Ans. Using Json.parse method

5. Name the browsers which support JSON.

Ans.  Firefox 3.5
         Chrome
         Opera 10
         Internet Explorer 8
         Safari

6. What is the MIME type of JSON?
Ans. "application/json"

7.  Which function is used to convert a JSON text into an Object?

Ans. eval() function

8. Which are the Data types supported by JSON?
Ans.  Number, String, Boolean, Array, Object, NULL

9.  What is JSON Parser?
Ans. JSON Parser is used to parse the JSON data into Objects.

10.  JSON Syntax.
Ans. JSON data is written as name/value pairs.
for Example : "Firstname" : "Sapna"

11. How to convert Javascript object to JSON?

Ans. JSON.stringify(Obj); method is used to convert javascript object to JSON.

12. List the benefits of JSON over XML.

Ans. It is faster & lighter than XML.
         XML data is all in the string while JSON can be interger, string, Array, Boolean

13. Which data types are used in JSON?
Ans. Number
         String
         Boolean
         Array
         Null
         Object

14. What is the file extension of the json file?
Ans. .json

15. Describe the syntax of JSON?
Ans.
       {
        "employee":
         [
         {"firstName": "Sapna" , "Department" : "Asp.net"},
         {"firstName": "Zia", "Department" : "Java" }
        ]
       }

16. Which function is used to convert JSON text into an object?
Ans. "eval"

17. What are the limitations of JSON?
Ans. JSON does not support comments
        It does not handle very complex data.
        It does not support multimedia formats like Images.

18. Is JSON programming language?
Ans. No JSON is not a programming language but it is the format to exchange data.

19. What is toJSON() method in JSON?
Ans. toJSON() method returns a string representation of Date object.

20. What is JSONP?
Ans. JSONP is the JSON with padding. JSONP sends data without any cross-domain issues.

21. What is JSON Viewer?
Ans. JSON Viewer represents data in more friendly manner.

22. What is the common use of JSON?
Ans. The common use of JSON is to exchange data from source to destination via API.

23. How to parse json in JQuery?
Ans. $json = '{"name":"Sapna","Designation":"Asp.Net Team Leader"}';
$obj = json_decode($json);
if(is_null($obj)) {
 die('Invalid JSON');
}


         

No comments:

Post a Comment

Thanks

SQL server tricky questions