{"id":44923,"date":"2022-11-22T23:47:33","date_gmt":"2022-11-22T23:47:33","guid":{"rendered":"https:\/\/www.arimetrics.com\/glosario-digital\/json"},"modified":"2026-09-30T22:09:16","modified_gmt":"2026-09-30T22:09:16","slug":"json","status":"publish","type":"encyclopedia","link":"https:\/\/www.arimetrics.com\/en\/digital-glossary\/json","title":{"rendered":"JSON"},"content":{"rendered":"<p><strong><img decoding=\"async\" class=\"boxpad alignright wp-image-44942 size-full\" src=\"https:\/\/www.arimetrics.com\/wp-content\/uploads\/2022\/12\/json.png\" alt=\"JSON\" width=\"300\" height=\"300\" srcset=\"https:\/\/www.arimetrics.com\/wp-content\/uploads\/2022\/12\/json.png 300w, https:\/\/www.arimetrics.com\/wp-content\/uploads\/2022\/12\/json-150x150.png 150w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/>Definition:<\/strong><\/p>\n<p>JSON, short for JavaScript Object Notation, is a <strong>text format<\/strong> used to represent and exchange structured data. It organizes information through objects, arrays, and simple values, using a compact syntax that many programming languages and <a href=\"https:\/\/www.arimetrics.com\/en\/digital-glossary\/software\">software<\/a> applications can read and generate.<\/p>\n<p>Although its name comes from <a href=\"https:\/\/www.arimetrics.com\/en\/digital-glossary\/javascript\">JavaScript<\/a>, JSON is not a programming language. It does not contain instructions or execute operations: it describes data. It should also be distinguished from a <a href=\"https:\/\/www.arimetrics.com\/en\/digital-glossary\/database\">database<\/a>, which may store JSON documents but provides additional functions to query, update, and manage information.<\/p>\n\n<h2>JSON syntax<\/h2>\n<p>A JSON document follows a <strong>defined syntax<\/strong>. Objects are enclosed in braces and contain pairs made up of a name and a value. Arrays are enclosed in brackets and preserve an ordered sequence of values. In both structures, commas separate elements and a colon separates each name from its value.<\/p>\n<p>The main rules are:<\/p>\n<ul>\n<li><strong>Quoted names:<\/strong> every member of an object uses a string name enclosed in double quotation marks.<\/li>\n<li><strong>Accepted values:<\/strong> values can be strings, numbers, objects, arrays, or the literals <code>true<\/code>, <code>false<\/code>, and <code>null<\/code>.<\/li>\n<li><strong>Double quotes:<\/strong> strings must be enclosed in double quotation marks rather than single quotation marks.<\/li>\n<li><strong>No trailing comma:<\/strong> the final member of an object or element of an array has no additional comma.<\/li>\n<li><strong>Optional whitespace:<\/strong> spaces, tabs, and line breaks can improve readability without changing meaning outside strings.<\/li>\n<li><strong>No comments:<\/strong> the standard syntax does not include comments, functions, or values such as <code>undefined<\/code>.<\/li>\n<\/ul>\n<p>These restrictions allow the same document to be interpreted consistently by different systems. In open exchanges between applications, JSON text is normally encoded in <strong>UTF-8<\/strong>.<\/p>\n<h2>JSON data types<\/h2>\n<p>JSON supports a limited set of <strong>value types<\/strong>. A string represents text; a number represents a quantity without formally distinguishing integers from decimals; booleans express true or false; and <code>null<\/code> represents a null value. Objects group named members, while arrays collect values in order.<\/p>\n<p>The format does not include specific types for dates, images, or binary files. A date is commonly transmitted as a string under an agreed convention, while binary data requires another representation or a separate channel. The recipient needs to understand this <strong>data contract<\/strong> to interpret the content beyond its syntax.<\/p>\n<p>Duplicate names within the same object should also be avoided. Some parsers keep the last value, others retain the first, and others report an error. A document may therefore be syntactically valid and still produce different results if its structure relies on that ambiguity.<\/p>\n<h2>Uses of JSON<\/h2>\n<p>JSON is frequently used to carry information between a client and a server. Many <a href=\"https:\/\/www.arimetrics.com\/en\/digital-glossary\/api\">APIs<\/a> use it in requests and responses sent over <a href=\"https:\/\/www.arimetrics.com\/en\/digital-glossary\/http\">HTTP<\/a> because it is relatively compact and parsers are available in most development environments.<\/p>\n<p>Its <strong>common uses<\/strong> include:<\/p>\n<ul>\n<li><strong>Web exchange:<\/strong> responses from services and applications connected through an API.<\/li>\n<li><strong>Configuration files:<\/strong> settings loaded by an application at startup or during execution.<\/li>\n<li><strong>System messages:<\/strong> events, tasks, or states passed between components in an architecture.<\/li>\n<li><strong>Document storage:<\/strong> records stored as documents when the selected system supports JSON structures.<\/li>\n<\/ul>\n<p>It is not always the right option. Compared with <a href=\"https:\/\/www.arimetrics.com\/en\/digital-glossary\/xml\">XML<\/a>, JSON has no native features such as attributes, namespaces, or comments. For large tabular datasets, it may be more repetitive than a row-oriented format. The choice depends on the structure, validation requirements, and systems that will consume the data.<\/p>\n<h2>JSON and JavaScript<\/h2>\n<p>JSON syntax is inspired by JavaScript object notation, but the two concepts are not equivalent. JSON is <strong>language independent<\/strong> and can be processed in Python, PHP, Java, R, and many other environments. Its grammar is also more limited than that of an object written directly in JavaScript code.<\/p>\n<p>The notation was derived from ECMAScript syntax, but its rules are described independently in RFC 8259 and ECMA-404. This <strong>technical standardization<\/strong> allows JSON to be implemented without depending on JavaScript.<\/p>\n<p>In JavaScript, <code>JSON.parse()<\/code> converts valid JSON text into a language value, while <code>JSON.stringify()<\/code> performs the reverse operation on compatible data. Parsing text with a dedicated parser is safer and more predictable than treating it as executable code.<\/p>\n<p>A valid example is:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"json\">{\n  \"books\": [\n    {\n      \"title\": \"The Lord of the Rings\",\n      \"author\": \"J. R. R. Tolkien\",\n      \"published\": 1954,\n      \"available\": true\n    },\n    {\n      \"title\": \"1984\",\n      \"author\": \"George Orwell\",\n      \"published\": 1949,\n      \"available\": false\n    }\n  ]\n}<\/pre>\n<p>The root value is an object with a <code>books<\/code> property. Its value is an array containing two objects. Each book combines strings, a number, and a boolean, showing how JSON can represent a <strong>nested structure<\/strong> without defining behavior.<\/p>\n<h2>JSON validation<\/h2>\n<p>Validating JSON first means checking that the text follows the grammar. A parser will detect issues such as incorrect quotation marks, unescaped characters, trailing commas, or unclosed braces. This <strong>syntax validation<\/strong> does not confirm that the names, types, and required fields match what an application expects.<\/p>\n<p>When structural validation is required, a schema or rules in the receiving system can be used. A <a href=\"https:\/\/www.arimetrics.com\/en\/digital-glossary\/api-rest\">REST API<\/a>, for example, may require a particular property to be a string, reject unknown fields, or restrict certain values.<\/p>\n<p>Before processing external data, systems should limit its size, check its types, and handle parser errors. JSON supports interoperability, but it does not by itself guarantee <strong>data quality<\/strong>, authenticity, or security.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Definition: JSON, short for JavaScript Object Notation, is a text format used to represent and exchange structured data. It organizes information through objects, arrays, and simple values, using a compact syntax that many programming languages and software applications can read and generate. Although its name comes from JavaScript, JSON is not a programming language. It [&hellip;]<\/p>\n","protected":false},"author":6,"featured_media":0,"template":"","encyclopedia-tag":[1275],"class_list":["post-44923","encyclopedia","type-encyclopedia","status-publish","hentry","encyclopedia-tag-data-exchange"],"_links":{"self":[{"href":"https:\/\/www.arimetrics.com\/en\/wp-json\/wp\/v2\/encyclopedia\/44923","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.arimetrics.com\/en\/wp-json\/wp\/v2\/encyclopedia"}],"about":[{"href":"https:\/\/www.arimetrics.com\/en\/wp-json\/wp\/v2\/types\/encyclopedia"}],"author":[{"embeddable":true,"href":"https:\/\/www.arimetrics.com\/en\/wp-json\/wp\/v2\/users\/6"}],"wp:attachment":[{"href":"https:\/\/www.arimetrics.com\/en\/wp-json\/wp\/v2\/media?parent=44923"}],"wp:term":[{"taxonomy":"encyclopedia-tag","embeddable":true,"href":"https:\/\/www.arimetrics.com\/en\/wp-json\/wp\/v2\/encyclopedia-tag?post=44923"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}