JavaScript Json interview questions

JSON is one of most popular data format used in all type of applications written using different technologies, lightweight and easy to deal with in client side applications. Here we see some Json interview questions for beginners.

JSON object interview questions
  1. 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
  2. How to convert Javascript objects into JSON?
    JSON.stringify(value); is used to convert Javascript objects into JSON.
    var obj={"webTrainingRoom":"jsonInterview"};
    JSON.stringify(obj); // '{"webTrainingRoom":"jsonInterview"}'
  3. List some benefits of JSON over XML?
    • JSON types: Number, Array, Boolean, String
    • XML data are all string
    • It is faster and lighter than XML as on the wire data format
    • XML data is typeless while JSON objects are typed
    • 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
  4. What are supported data types in JSON ?
    Below are the data types supported in JSON.
    Numbers: Integer, float or Double
    String: string of Unicode characters, must be rapped into double quotes “”
    Boolean: True or false
    Array: ordered list of 0 or more values
    Objects : An unordered collection key/ value pairs
    Null: An Empty value
  5. What are 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.

  6. How do you decode a JSON string?
    JSON.parse method to decode a JSON string into a Javascript object.
  7. 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.
  8. 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
  9. What are the properties of JSON
    JSON is built on two structures:

    A collection of name/value pairs. In various languages, this is realized as an object, record, struct, dictionary, hash table, keyed list, or associative array.

    An ordered list of values. In most languages, this is realized as an array, vector, list, or sequence.

JavaScript Course Online, Check FREE JSON Tutorial
javascript course online
free javascript tutorial online
Interview Question Answers | Fresher Job Interview Tips