JSON INTERVIEW QUESTIONS AND ANSWERS 2021
Q1. What does JSON stand for?
Answer: JSON stands for “JavaScrt Object Notation”.
Q2. What is JSON? Explain?
Answer : JSON is the abbreviation of JavaScript Object Notation. It is one of the simplest data interchange format. Itis also independent of programming language and platform. Its lightweight text-based structure makes it easily readable by a human. It is derived from JavaScript for presenting simple data in the form of key-value pairs.
Q3. Who is known as the father of JSON?
Answer: Douglas Crockford is known as the father of JSON. Douglas Crockford was the person who originally defined the JSON format back in 2000.
Q4. 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.
Q5. What are natively supported JSON types?
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
Q6. Explain what is JSON objects?
An object can be defined as an unordered set of name/value pairs. An object in JSON starts with {left brace} and finish or ends with {right brace}. Every name is followed by: (colon) and the name/value pairs are parted by, (comma).
Q7. Explain how to transform JSON text to a JavaScript object?
One of the common use of JSON is to collect JSON data from a web server as a file or HTTP request and convert the JSON data to a JavaScript, ant then it avails the data in a web page.
Q8. Mention what is the rule for JSON syntax rules? Give an example of JSON object?
JSON syntax is a set of the JavaScript object notation syntax.
- Data is in name/value pairs
- Data is separated by comma
- Curly brackets hold objects
- Square bracket holds arrays
Q9. Mention what is the file extension of JSON?
Answer : File extension of JSON is .json
Q10. Do JSON support all the platforms?
Answer : JSON almost supports all the platforms and programming languages because of its text format and most of the technologies mainly work with data transmission between the systems that support JSON format. There are many languages like PHP, Java, javascript etc.
Q11. How JSON has been built?
Answer: This is the basic JSON Interview Questions asked in an interview. JSON is built on two structures that are the collection of name/value pairs and ordered list of values. These are the universal data structures like object, array, string, number, and value.
Q12. What programming languages supported by JSON?
Answer: 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.
Q13. 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
Q14. What are the properties of JSON?
These properties make JSON an ideal data-interchange language.
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.
Q15. Why do we use JSON?
The JSON format is often used for serializing and transmitting structured data over a network connection. It is used primarily to transmit data between a server and web application, serving as an alternative to XML.
Q16. What is JSON data?
JSON, or JavaScript Object Notation, is a minimal, readable format for structuring data. In JSON data is nothing but a information. It is used primarily to transmit data between a server and web application, as an alternative to XML.
Q17. Is JSON markup language?
JSON is like XML in that it is used to structure data in a text format and is commonly used to exchange data over the Internet. JSON is not a markup language. JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write.
Q18. What is JSON Text?
A JSON text is a sequence of tokens formed from Unicode code points that conforms to the JSON value grammar. The set of tokens includes six structural tokens, strings, numbers,and three literal name tokens.
Q19. What is JSON Value?
Answer: A JSON value can be an object, array, number, string, true, false, or null.
Q20. What is JSON Syntax?
JSON syntax is derived from JavaScript object notation syntax. Data is in name/value pairs. Data is separated by commas. Curly braces hold objects. Square brackets hold arrays.
Q21. What is JSON Array?
An array structure is a pair of square bracket tokens surrounding zero or more values. An array is an ordered collection of values. An array begins with [ (left bracket) and ends with ] (right bracket). Values are separated by , (comma).
Q22. What is Number in JSON?
JSON Numbers – A number is very much like a C or Java number, except that the octal and hexadecimal formats are not used. A number is a sequence of decimal digits with no superfluous leading zero.
Q23. What is JSON String?
A string is a sequence of zero or more Unicode characters, wrapped in double quotes, using backslash escapes. A character is represented as a single character string. A string is very much like a C or Java string.
Q24. What is JSON RPA Java?
JSON-RPC is a simple remote procedure call protocol similar to XML-RPC although it uses the lightweight JSON format instead of XML (so it is much faster).
Q25. What is a JSON parser?
JSON parser to parse JSON object and MAINTAIN comments. By using JSON, when receiving data from a web server, the data should be always in a string format. We use JSON.parse() to parse the data and it becomes a JavaScript object.
Q26. Which browser provides native JSON support?
All modern browsers support native JSON encoding/decoding (Internet Explorer 8+, Firefox 3.1+, Safari 4+, and Chrome 3+). Basically, JSON.parse(str) will parse the JSON string in str and return an object, and JSON.stringify(obj) will return the JSON representation of the object obj.
Q27. What is the difference between JSON parse and JSON Stringify?
JSON.stringify() is to create a JSON string out of an object/array. They are the inverse of each other. JSON.stringify() serializes a JS object into a JSON string, whereas JSON.parse() will deserialize a JSON string into a JS object.
Q28. What is the MIME type of JSON?
Answer) The MIME media type for JSON text is application/json . The default encoding is UTF-8.
Q29. What is the use of JSON Stringify?
The JSON.stringify() method converts a JavaScript value to a JSON string, optionally replacing values if a replacer function is specified, or optionally including only the specified properties if a replacer array is specified.
Q30. What does JSON parse do?
The JSON.parse() method parses a JSON string, constructing the JavaScript value or object described by the string. An optional reviver function can be provided to perform a transformation on the resulting object before it is returned.
Q31. What is serialization in Javascript?
The serialize() method creates a URL encoded text string by serializing form values. You can select one or more form elements (like input and/or text area), or the form element itself. The serialized values can be used in the URL query string when making an AJAX request.
Q32. What is Polyfill?
The JSON object is not supported in older browsers. We can work around this by inserting a piece of code at the beginning of your scripts, allowing use of JSON object in implementations which do not natively support it (like Internet Explorer 6) is called Polyfill.
Q33. What is toJSON() method in JOSN?
The toJSON() method returns a string representation of the Date object.
Q34. What is JSONP?
JSONP stands for JSON with Padding. JSONP is a method for sending JSON data without worrying about cross-domain issues. JSONP does not use the XMLHttpRequest object. JSONP uses the <script> tag instead.
Q35
. Mention which function is used to convert a JSON text into an object?
To convert JSON text into an object “eval” function is used.
Q36. Mention what is the function used for encoding JSON in PHP?
For encoding JSON in PHP, json_encode () function is used. This function returns the JSON representation of a value on success or false on failure.
Q37. Mention what are the drawbacks of JSON?
Drawbacks of json are
- It does not contain type definition
- It lacks some sort of DTD
Q38. 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.
Q39. How do you decode a JSON string?
Use JSON.parse method to decode a JSON string into a Javascript object.
Q40. What is BSON?
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.
Q41. Name the browsers that support JSON format?
Support for JSON is included in almost all the new versions of the browsers. Internet Explorer, Chrome, Safari, Mozilla Firefox, etc. all support JSON format.
Q42. Can a comment be added inside a JSON file?
As per the structure, JSON doesn’t support any comments. The only thing that can be done is to use a Key or data object to hold your comments and during the processing of the JSON make sure that your application ignores the given data element.
Q43. Name some of the most widely used libraries in .net for JSON?
There are several popular libraries available for JSON in .net. some of them are:
- Newtonsoft: It is one of the most widely used frameworks to convert using c#. It is quite famous because of its flexibility and performance. It also supports JSON to XML conversion.
- DataContractJsonSerializer: This is the built-in library provided by Microsoft for handling JSON objects within the .net environment.
Q44. What is the use of JSON in Java?
The Java API for JSON Processing provides portable APIs to parse, generate, transform, and query JSON. JSON (JavaScript Object Notation) is a lightweight, text-based, language-independent data exchange format that is easy for humans and machines to read and write.
Q45. Why do we use JSON in PHP?
A common use of JSON is to read data from a web server, and display the data in a web page. This chapter will teach you how to exchange JSON data between the client and a PHP server.
Q46. What is JSON Formatter?
The JSON Formatter & Validator helps debugging JSON data by formatting and validating JSON data so that it can easily be read by human beings.
Q47. What is JSON Viewer?
JSON Viewer – Convert JSON Strings to a Friendly Readable Format.
Q48. What is JSON Validator?
The JSON Validator helps debugging JSON data by formatting and validating JSON data so that it can easily be read by human beings.
Q49. Why do we use JSON in Android?
JSON stands for JavaScript Object Notation.It is an independent data exchange format and is the best alternative for XML.
Q50. Why do we use JSON in Python?
Python programming language is used to encode and decode JSON objects.
Python encode() function encodes the Python object into a JSON string representation.
Python decode() function decodes a JSON-encoded string into a Python object.