JSON- JavaScript Object Notation is a text-based format used to exchange data on the web. The good thing about JSON is that humans can easily read the data, interpret it, and derive the meaning. From the name suggests, it is clear that it is for JavaScript programming language, but it is not restricted to this only. It is also available for other languages too such as Python, Ruby, PHP, and JAVA.
Below are few major features of Json
Q1. What is JSON?
JSON stands for JavaScript Object Notation which is a data storage and communication format based on key-value pair of JavaScript object literals. It is derived from the JavaScript programming language for representing simple data structures and associative arrays, called objects. JSON is a minimal, readable format for structuring data commonly used for transmitting data in web applications.
Q2. Enlist few advantages of using JSONs?
The advantages of using JSONs are as follows:
Q3. Who is known as the father of JSON?
Douglas Crockford is known as the father of JSON. He is an American computer programmer and entrepreneur who is involved in the development of the JavaScript language and JavaScript Object Notation or JSON.
Q4. What extension is used to save JSON file?
The extension that is used to save JSON files is .json.
Q5. Enlist data types available in JSON?
The data types available in JSON are as follows:
Q6. What two main structures used to compose JSON?
The two main structures used to compose JSON are keys and values. It can be explained as:
Key: A key is always a string enclosed in quotation marks.
Value: A value can be a string, number, boolean expression, array, or object.
Q7. How do you decode a JSON string?
You can decode a JSON string with the help of json_decode() function. json_decode() function iis an inbuilt function in PHP that can converts a JSON encoded string into a PHP variable. Syntax: json_decode( $json, $assoc = FALSE, $depth = 512, $options = 0 )
Q8. What is the default value of a constructor's prototype?
The constructor property returns a reference to the Object constructor function that created the instance object. There is no default value of a constructor's prototype.
Q9. List some benefits of JSON over XML?
Some of the benefits of JSON over XML are as follows:
Q10. What is MIME type for JSON data?
MIME-type stands for A multipurpose internet mail extension that is an internet standard that describes the contents of internet files based on their natures and formats. In general, the text/plain was typically used for JSON, but according to IANA, the official MIME type for JSON is application/JSON.
Q11. What is JSON Validator?
A JSON Validator is used to validates a JSON string against RFC 4627 that is the application/json media type for JSON and against the JavaScript language specification. A JSON Validator can be configured to be lenient or strict.
Q12. What is JSON Schema?
In JSON, a JSON Schema is a grammar language for defining the structure, content, and semantics of JSON objects, that lets you specify metadata about what an object's properties mean and what values are valid for those properties. It is a specification for JSON-based format for defining the structure of JSON data.
Q13. What is JSON-RPC? List some Features of JSON-RPC-Java.
JSON-RPC is a call protocol that uses JSON for encoding messages. It is a simple and easy protocol just like XML-RPC. It supports multiple calling and notifications. In short, JSON-RPC is the method of sending a request to someone and receiving the response from another side.
Q14. What is BSON?
BSON stands for Binary JSON which is used by MongoDB. It is basically a superset of JSON with some more data types, most importantly binary byte array, and uses more space as compared to JSON and it allows you to effectively skip the records that you’re not fascinated with when perusing it.
Q15. How to convert an Object into JSON?
You can convert a Java object into a JSON object with the help of the GSON library. You can perform it by following the given steps:
Q16. What does $.parseJSON() do ?
In JSON the parse() method parses a JSON string, constructing the JavaScript value or object described by the string. The $.parseJSON() parses a string containing JSON and returns the de-serialized object. Web module only.
The use of JSON is growing rapidly due to its light-weight and compact feature. Along with this, sharing is too fast because it uses an array to store the data and also you can share any size of data such as videos, images, etc. This is a brief introduction to JSON. If you want to know its advantages, disadvantages, and features, then visit our JSON online interview questions. This will help you to understand the basic concepts of JSON and enable you to crack any interviews. Check and start today!
JSON |
XML |
JSON stands for JavaScript Object Notation XML stands for extensible Markup Language. JSON has a more compact style than XML, and it is more readable. | XML is less simple, therefore, not easy to read |
JSON is much lightweight, so it can make significant improvements in RESTful APIs working with complex systems. | XML is not much lightweight. |
JSON uses less data, thus, increases the parsing speed. | XML software takes more time in parsing due to the DOM manipulation libraries. |
JSON uses a map data structure XML uses a tree structure JSON is data-oriented. | XML is document-oriented. |
JSON doesn't provide display capabilities. | XML provides display capabilities because it is a markup language. |
JSON is less secured than XML due to the possibility of hacking. | XML is more secure. |
JSON supports limited data types such as text and number data types. | XML support many data types such as images, charts, graphs, texts, etc. JSON supports an array. XML doesn’t support array. |
Advantage of JSON:
Disadvantages of JSON:
Valid name is required.
Valid name is required.
Valid email id is required.
Sharad Jaiswal
My name is Sharad Jaiswal, and I am the founder of Conax web Solutions. My tech stacks are PHP, NodeJS, Angular, React. I love to write technical articles and programming blogs.