JSON Interview Questions

JSON Interview Questions

What is JSON?.

JSON (JavaScript Object Notation) is a data storage and communication format based on a key-value pair of JavaScript object literals. It is a lightweight text-based open standard designed for human-readable data interchange.

Quick Questions About JSON
JSON store data in key-value format
Media typeapplication/json
Filename extension.json
JSON full formJavaScript Object Notation
JSON is developed byDouglas Crockford
Data types supported by JSONNumber, String, Boolean, Array, Object, and null
No. of Questions18
Download JSON Interview Questions PDF

Below are the list of Best JSON Interview Questions and Answers

JSON (JavaScript Object Notation) is a data storage and communication format based on key-value pair of JavaScript object literals. It is a lightweight text-based open standard designed for human-readable data interchange which is derived from the JavaScript programming language for representing simple data structures and associative arrays, called objects.

In JSON

  • all property names are surrounded by double quotes.
  • values are restricted to simple data: no function calls, variables, comments, or computations.

JSON is used for communication between javascript and serverside technologies.

JSON.stringify(value); is used to convert Javascript objects into JSON.

Example Usage:

    var obj={"website":"Onlineinterviewquestions"};
    JSON.stringify(obj); // '{"website":"Onlineinterviewquestions"}'
JSON supports Objects, Arrays, Primitives (strings, numbers, boolean values (true/false), null) data types.
Object.create creates a new object with the specified prototype object and properties.
It returns true if the property was set on an actual object rather than inherited.
$.parseJSON() takes a well-formed JSON string and returns the resulting JavaScript value.
You can create Object by
  • object literals
  • Object.create
  • constructors
A plain, empty object that derives from Object.prototype is the default value of a constructor’s prototype
  • It is faster and lighter than XML as on the wire data format
  • XML data is typeless while JSON objects are typed
  • JSON types: Number, Array, Boolean, String
  • XML data are all string
  • 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
  • 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.
Take Free: Json MCQ & Quiz
Douglas Crockford called as the Father of JSON. JSON is based on ECMAScript.
JSON-RPC: JSON-RPC is a simple remote procedure call protocol similar to XML-RPC although it uses the lightweight JSON format instead of XML.

JSON-RPC-Java is a Java implementation of the JSON-RPC protocol.Below is list of some of its features

  • Dynamically call server-side Java methods from JavaScript DHTML web applications. No Page reloading.
  • Asynchronous communications.
  • Transparently maps Java objects to JavaScript objects.
  • Lightweight protocol similar to XML-RPC although much faster.
  • Leverages J2EE security model with session specific exporting of objects.
  • Supports Internet Explorer, Mozilla, Firefox, Safari, Opera, and Konqueror.
Following data types are natively 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

Read Latest Jquery interview questions

BSON is the superset of JSON, which used by MongoDB.BSON supports the embedding of documents and arrays within other documents and arrays. BSON also contains extensions that allow representation of data types that are not part of the JSON spec.
JSON.stringify method is used to convert an Javascript Object into JSON.
Syntax:
let json = JSON.stringify(value[, replacer, space])
Following JS-specific properties are skipped by JSON.stringify method
  • Function properties (methods).
  • Symbolic properties.
  • Properties that store undefined.
Use JSON.parse method to decode a JSON string into a Javascript object.
Deleting an Element from JSON Obj
var exjson = {'key':'value'};
delete exjson['key'];