Json Interview Questions and Answers
Q1. What is the overall shape of JSON?
Ans: JSON stands for JavaScript Object Notation.
Q2. What is the definition of JSON?
Ans: It is a textual content-based layout and designed for the trade of records among different systems. It is lightweight records-interchange format as compare to XML. It makes use of JavaScript syntax. JSON facts may be study and use via any programming language.
Q3. What is JSON used for?
Ans: JSON is used for communication among server side technologies and cellular app or website.
Q4. What is the record extension of JSON?
Ans: The document extension of JSON is .Json.
Q5. Who created the JSON?
Ans: Douglas Crockford
Q6. Who is Father of JSON?
Ans: Douglas Crockford
Q7. Why It is so popular?
Ans:
It is light weight preferred for change records
It is independent of language
It is independent of Hosting Server
Human Readable
Easy to Encode
Easy to Decode
Used in Mobile utility
Q8. What is file extension of JSON?
Ans: json
Q9. What is the rule of thumb for writing JSON?
Ans:
JSON is the collection of key and price pair separated via the comma.
Key and value are separated via the colon (:).
Square brackets are used to shop JSON array.
Curly brackets are used to maintain JSON gadgets.
Q10. How many statistics kinds are there in JSON?
Ans: There are six forms of information kinds in JSON -
Number
String
Boolean
Array
Object
Null
Q11. JSON vs. XML?
Ans:
XML requires XML parser to parse it. JSON is parsed with the help of JavaScript functions.
XML is heavy and verbose. JSON is short and light-weight.
File extension of XML information is .Xml. File extension of JSON records is .Json.
XML is report primarily based. JSON is facts based.
JSON is easy to study, write and apprehend. XML is much less simple to examine, write and understand.
Array is supported via JSON. Array isn't always supported through XML.
JSON stands for JavaScript Object Notation. XML stands for Extensible Markup Language.
Q12. What is MIME kind for JSON statistics?
Ans: MIME type is utility/json.
Q13. Which functions are used for encoding and interpreting JSON in PHP?
Ans: For encoding, json_encode() characteristic is used. This characteristic takes PHP price like array as enter and returns JSON representation of it. For deciphering, json_decode() characteristic is used. This function takes JSON string as enter and returns associative array.
HubSpot Video
Q14. What is using JSON.Stringify() feature?
Ans: JSON.Stringify() feature is used to convert a JavaScript price(Object) right into a JSON string.
Q15. What is MIME kind for JSON data?
Ans: MIME kind is utility/json.
Q16. Which functions are used for encoding and decoding JSON in PHP?
Ans: For encoding, json_encode() feature is used. This characteristic takes PHP value like array as enter and returns JSON representation of it. For decoding, json_decode() function is used. This characteristic takes JSON string as input and returns associative array.
Q17. What is the use of JSON.Stringify() function?
Ans: JSON.Stringify() function is used to transform a JavaScript value(Object) right into a JSON string.
Q18. What is the motive of JSON.Parse() function?
Ans: This characteristic is used to transform JSON string right into a JavaScript item.
Q19. What is JSON Parser?
Ans: JSON Parser is used to parse the JSON information into object to use its cost. JSON may be parse by javaScript, jQuery and PHP.
Q20.What is JSON-RPC?
Ans: Remote Procedure call protocol with use of JSON. It is much like XML-RPC most effective difference, It use JSON as opposed to XML.
Q21. What is JSON-RPC-Java?
Ans: JSON-RPC-Java is a Java implementation of the JSON-RPC protocol.
Q22. How to create json from personal home page array?
Ans: $array = array('call'=>'PHP Tutorial','Description'=>'Web era professionals notes');
echo json_encode($array);
Q23. How to get PHP array from json Object?
Ans: $item='"name":"PHP Tutorial","Description":"Expert in web era"'; $array = json_decode($object);
Q24. How to parse JSON in JavaScript?
Ans: var json = '"call":"PHP Tutorial","Description":"Web generation experts notes"'
var obj = JSON.Parse(json);
//alert(obj.Name);
Q25. How to create JSON Object from JavaScript?
Ans: var obj = ; obj['name']='personal home page-educational-php.Blogspot.In'; //string obj['age'] = 32; // integer. Obj['marks']= [80,70,60,50,60,80]; //array
Q26. How to parse JSON in jQuery?
Ans: var json = '"name":"PHP Tutorial","Description":"Web generation specialists notes"'
obj = $.ParseJSON(json);
//alert(obj.Call);
Q27. How to Validate json in personal home page?
Ans: $json = '"call":"PHP Tutorial","Description":"Web era specialists notes"';
$obj = json_decode($json);
if(is_null($obj))
die('Invalid JSON');
Q28. How to Validate json in javascript?
Ans: function isValidJson(jsonData) try JSON.Parse(jsonData); return actual; seize (e) return fake; var json = '"call":"PHP Tutorial","Description":"Web technology specialists notes"' isValidJson(json);
Q29. How to Validate json in jQuery?
Ans: characteristic isValidJson(jsonData) attempt $.ParseJSON(jsonData); go back real; catch (e) go back fake; var json = '"name":"PHP Tutorial","Description":"Web generation specialists notes"' isValidJson(json);
Q30. How to get JSON reaction in Ajax?
Ans:
$.Ajax(
dataType: "json",
url: '/ajax/url',
data: 'call=php-academic-Hypertext Preprocessor',
achievement: function(information)
//records
);