JSON interview questions and answers - LearnHowToCode SarkariResult.com Interview Questions and Answers LearnHowToCodeOnline
JSON interview questions

JSON interview questions and answers

JSON interview questions and answers

Below are the list of top 12 basic JSON interview questions and their answers for beginners and Freshers
  1. What is JSON? For what is used for?
  2. How to convert Javascript objects into JSON?
  3. List types Natively supported by JSON?
  4. What does Object.create do
  5. What does hasOwnProperty method do?
  6. What does $.parseJSON() do?
  7. What are different ways to create objects?
  8. What is the default value of a constructor's prototype?
  9. List some benefits of JSON over XML?
  10. What is the difference between JSON and JSONP?
  11. Who is the Father of JSON and What is the scripting language JSON is based on?
  12. What is JSON-RPC? List some Features of JSON-RPC-Java.

Q1. 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. 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.

Q2. How to convert Javascript objects into JSON?

JSON.stringify(value); is used to convert Javascript objects into JSON.
Example Usage:
    
    var obj={"website":"devquora.com"};
    JSON.stringify(obj); // '{"website":"devquora.com"}'

Q3. List types Natively supported by JSON?

JSON supports Objects, Arrays, Primitives (strings, numbers, boolean values (true/false), null) data types.
Q4. What does Object.create do?
Object.create creates a new object with the specified prototype object and properties.
Q5. What does hasOwnProperty method do?
It returns true if property was set on actual object rather than inherited.
Q6. What does $.parseJSON() do?
$.parseJSON() takes a well-formed JSON string and returns the resulting JavaScript value.

Q7. What are different ways to create objects?

You can create Object by
  • object literals
  • Object.create
  • constructors

Q8. What is the default value of a constructor's prototype?

A plain, empty object that derives from Object.prototype is the default value of a constructor's prototype.
Q9. List some benefits of JSON over XML?
  • 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
Q10. What is 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.
Q11. Who is the Father of JSON and What is the scripting language JSON is based on?
Douglas Crockford called as the Father of JSON. JSON is based on ECMAScript.
Q12. What is JSON-RPC? List some Features of JSON-RPC-Java.
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.
  • The 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.

About Mariano

I'm Ethan Mariano a software engineer by profession and reader/writter by passion.I have good understanding and knowledge of AngularJS, Database, javascript, web development, digital marketing and exploring other technologies related to Software development.

0 comments:

Featured post

Political Full Forms List

Acronym Full Form MLA Member of Legislative Assembly RSS Really Simple Syndication, Rashtriya Swayamsevak Sangh UNESCO United Nations E...

Powered by Blogger.