Online Training for MVC Web Designing Development, MS SQL, Digital Marketing

Json interview questions answers

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
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"}'
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
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
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.
How do you decode a JSON string?
JSON.parse method to decode a JSON string into a Javascript object.
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.
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
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.
Name Email Website
Group Training