{"id":27006,"date":"2018-03-05T15:30:10","date_gmt":"2018-03-05T15:30:10","guid":{"rendered":"https:\/\/www.testingdocs.com\/questions\/?p=27006"},"modified":"2025-05-17T07:26:55","modified_gmt":"2025-05-17T07:26:55","slug":"what-is-json","status":"publish","type":"post","link":"https:\/\/www.testingdocs.com\/questions\/what-is-json\/","title":{"rendered":"What is JSON?"},"content":{"rendered":"<h1>What is JSON?<\/h1>\n<p>JSON stands for JavaScript Object Notation. It is a lightweight data storage and communication protocol that uses JavaScript syntax. JSON stores data in key-value pairs and it is primarily used in REST services to exchange data.<\/p>\n<p>It is easy for humans to read and write, and easy for machines to parse and generate. JSON is primarily used to transmit data between a server and a web application or between different parts of an application.<\/p>\n<p data-start=\"0\" data-end=\"50\">The file extension for a JSON file is <strong data-start=\"38\" data-end=\"49\"><code class=\"\" data-line=\"\">.json<\/code><\/strong><\/p>\n<p data-start=\"52\" data-end=\"108\">For example, a file containing JSON data might be named as follows:<\/p>\n<ul data-start=\"110\" data-end=\"157\">\n<li data-start=\"110\" data-end=\"123\"><code class=\"\" data-line=\"\">data.json<\/code><\/li>\n<li data-start=\"124\" data-end=\"139\"><code class=\"\" data-line=\"\">config.json<\/code><\/li>\n<li data-start=\"140\" data-end=\"157\"><code class=\"\" data-line=\"\">response.json<\/code><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-27010\" src=\"https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/What-is-JSON.png\" alt=\"What is JSON\" width=\"1280\" height=\"720\" title=\"\" srcset=\"https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/What-is-JSON.png 1280w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/What-is-JSON-300x169.png 300w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/What-is-JSON-1024x576.png 1024w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/What-is-JSON-768x432.png 768w\" sizes=\"auto, (max-width: 1280px) 100vw, 1280px\" \/><\/p>\n<h2>Features of JSON<\/h2>\n<p>Some of the features of JSON are as follows:<\/p>\n<ul>\n<li><strong>Data format<\/strong>: It represents data in the form of key-value pairs, similar to how objects or dictionaries work in programming languages.<\/li>\n<li><strong>Human-readable<\/strong>: The syntax is simple and easy for humans to understand and edit.<\/li>\n<li><strong>Language-independent<\/strong>: Although it originated from JavaScript, it is supported by most programming languages, including Python, Java, PHP, and more.<\/li>\n<\/ul>\n<h2>Structure of JSON<\/h2>\n<p>JSON has two main components:<\/p>\n<ul>\n<li><strong>Objects<\/strong>: Enclosed in curly braces <code class=\"\" data-line=\"\">{}<\/code> and contain key-value pairs. Keys must be strings, and values can be strings, numbers, arrays, other objects, or booleans.<\/li>\n<li><strong>Arrays<\/strong>: Ordered lists of values, enclosed in square brackets <code class=\"\" data-line=\"\">[]<\/code>.<\/li>\n<\/ul>\n<h2>Example of JSON<\/h2>\n<pre>{\r\n  \"name\": \"John\",\r\n  \"age\": 30,\r\n  \"isStudent\": false,\r\n  \"address\": {\r\n    \"street\": \"123 Main St\",\r\n    \"city\": \"New York\"\r\n  },\r\n  \"courses\": [\"Math\", \"Science\", \"History\"]\r\n}\r\n<\/pre>\n<p>In this example:<\/p>\n<ul>\n<li>The outer structure is an <strong>object<\/strong>.<\/li>\n<li>The keys are <code class=\"\" data-line=\"\">&quot;name&quot;<\/code>, <code class=\"\" data-line=\"\">&quot;age&quot;<\/code>, <code class=\"\" data-line=\"\">&quot;isStudent&quot;<\/code>, <code class=\"\" data-line=\"\">&quot;address&quot;<\/code>, and <code class=\"\" data-line=\"\">&quot;courses&quot;<\/code>.<\/li>\n<li>The value of <code class=\"\" data-line=\"\">&quot;address&quot;<\/code> is another object, while <code class=\"\" data-line=\"\">&quot;courses&quot;<\/code> is an array.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>JSON is widely used in APIs and web services for data exchange because of its simplicity and efficiency.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>What is JSON? JSON stands for JavaScript Object Notation. It is a lightweight data storage and communication protocol that uses JavaScript syntax. JSON stores data in key-value pairs and it is primarily used in REST services to exchange data. It is easy for humans to read and write, and easy for machines to parse and [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[40],"tags":[],"class_list":["post-27006","post","type-post","status-publish","format-standard","hentry","category-java","has-post-title","has-post-date","has-post-category","has-post-tag","has-post-comment","has-post-author",""],"_links":{"self":[{"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/posts\/27006","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/comments?post=27006"}],"version-history":[{"count":6,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/posts\/27006\/revisions"}],"predecessor-version":[{"id":27426,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/posts\/27006\/revisions\/27426"}],"wp:attachment":[{"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/media?parent=27006"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/categories?post=27006"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/tags?post=27006"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}