HOME

TheInfoList




JSON (JavaScript Object Notation, pronounced ; also ) is an
open standard An open standard is a standard Standard may refer to: Flags * Colours, standards and guidons * Standard (flag), a type of flag used for personal identification Norm, convention or requirement * Standard (metrology), an object that bears a de ...
file format A file format is a way that information is encoded for storage in a . It specifies how s are used to encode information in a digital storage medium. File formats may be either or and may be either unpublished or open. Some file formats ar ...
and data interchange format that uses
human-readable 220px, ISBN represented as EAN-13 bar code showing both human-readable and machine-readable data A human-readable medium or human-readable format is any encoding of data Data are units of information Information can be thought of as ...
text to store and transmit data objects consisting of
attribute–value pair An attribute–value pair, also called a name–value pair, key–value pair, or field–value pair, is a fundamental data representation Data (treated as singular, plural, or as a mass noun) is any sequence of one or more symbol A symbol ...
s and
array ARRAY, also known as ARRAY Now, is an independent distribution company launched by film maker and former publicist Ava DuVernay Ava Marie DuVernay (; born August 24, 1972) is an American filmmaker. She won the directing award in the U.S. dram ...
s (or other
serializable
serializable
values). It is a common data format with diverse uses in
electronic data interchangeElectronic data interchange (EDI) is the concept of businesses electronically communicating information that was traditionally communicated on paper, such as purchase orders and invoices. Technical standards for EDI exist to facilitate parties trans ...
, including that of
web application A web application (or web app) is application software that runs on a web server, unlike computer-based software programs that are run locally on the operating system (OS) of the device. Web applications are accessed by the user through a web brow ...
s with servers. JSON is a language-independent data format. It was derived from
JavaScript JavaScript (), often abbreviated JS, is a programming language A programming language is a formal language comprising a Instruction set architecture, set of instructions that produce various kinds of Input/output, output. Programming lang ...

JavaScript
, but many modern
programming language A programming language is a formal language In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calcu ...

programming language
s include code to generate and
parse Parsing, syntax analysis, or syntactic analysis is the process of analyzing a string of symbols A symbol is a mark, sign, or word In linguistics, a word of a spoken language can be defined as the smallest sequence of phonemes that can be ut ...

parse
JSON-format data. JSON filenames use the extension .json.
Douglas Crockford Douglas Crockford is an United States, American computer programmer and entrepreneur who is involved in the development of the JavaScript language. He popularized the data format JSON (JavaScript Object Notation), and has developed various JavaScr ...

Douglas Crockford
originally specified the JSON format in the early 2000s. He and
Chip Morningstar Chip Morningstar is an American author, developer, software programmer and designer of software systems, mainly for online entertainment and communication. Morningstar held many jobs throughout his career in the research and development of technol ...
sent the first JSON message in April 2001.


Naming and pronunciation

The acronym originated at State Software, a company co-founded by
Douglas Crockford Douglas Crockford is an United States, American computer programmer and entrepreneur who is involved in the development of the JavaScript language. He popularized the data format JSON (JavaScript Object Notation), and has developed various JavaScr ...

Douglas Crockford
and others in March 2001. The 2017
international standard An international standard is a technical standard A technical standard is an established norm Norm, the Norm or NORM may refer to: In academic disciplines * Norm (geology), an estimate of the idealised mineral content of a rock * Norm (philoso ...
(ECMA-404 and ISO/IEC 21778:2017) specifies "Pronounced , as in '
Jason Jason ( ; ) was an ancient Greece, ancient Greek Greek mythology, mythological hero and leader of the Argonauts, whose quest for the Golden Fleece featured in Greek literature. He was the son of Aeson, the rightful king of Iolcos. He was marrie ...

Jason
and The
Argonauts red-figure krater A krater or crater ( grc-gre, , ''kratēr'', literally "mixing vessel") was a large vase in Ancient Greece, used for the dilution of wine with water. Form and function At a Greek symposium, kraters were placed in the cente ...

Argonauts
. The first (2013) edition of ECMA-404 did not address the pronunciation. The ''UNIX and Linux System Administration Handbook'' states that "
Douglas Crockford Douglas Crockford is an United States, American computer programmer and entrepreneur who is involved in the development of the JavaScript language. He popularized the data format JSON (JavaScript Object Notation), and has developed various JavaScr ...

Douglas Crockford
, who named and promoted the JSON format, says it's pronounced like the name Jason. But somehow, 'JAY-sawn' seems to have become more common in the technical community." Crockford said in 2011, "There's a lot of argument about how you pronounce that, but I strictly don't care."


Standards

After had been available as its "informational" specification since 2006, JSON was first standardized in 2013, as ECMA-404. , published in 2017, is the current version of the
Internet Standard An Internet Standard in computer network engineering refers to the normative specification of a technology that is appropriate for the Internet. Internet Standards allow interoperation of hardware and software from different sources which allows th ...
br>STD 90
and it remains consistent with ECMA-404. That same year, JSON was also standardized as
ISO The International Organization for Standardization (ISO ) is an international standard An international standard is a technical standard A technical standard is an established norm (social), norm or requirement for a repeatable technical task w ...

ISO
/
IECIEC may refer to: Businesses and organisations * International Electrotechnical Commission The International Electrotechnical Commission (IEC; in French: ''Commission électrotechnique internationale'') is an international standards organizati ...
21778:2017. The ECMA and
ISO The International Organization for Standardization (ISO ) is an international standard An international standard is a technical standard A technical standard is an established norm (social), norm or requirement for a repeatable technical task w ...

ISO
standards describe only the allowed syntax, whereas the RFC covers some security and interoperability considerations.


History

JSON grew out of a need for stateless, real-time server-to-browser communication protocol without using browser plugins such as
Flash FLASH, acronym of ''Free Electron LASer in Hamburg'', a particle accelerator , a synchrotron collider type particle accelerator at Fermi National Accelerator Laboratory (Fermilab), Batavia, Illinois, USA. Shut down in 2011, until 2007 it was the ...
or
Java Java ( id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 147.7 million people, Java is the world's List of ...
applets, the dominant methods used in the early 2000s. A precursor to the JSON libraries was used in a children's digital asset trading game project named
Cartoon Orbit Cartoon Orbit was a children's Online game, online gaming network created by Turner Broadcasting System, Turner Online to promote its shows and partners. Created as an addition to the Cartoon Network website, Cartoon Orbit opened to the public in O ...
at Communities.com (at which State Software's co-founders had all worked previously) for Cartoon Network, which used a browser side plug-in with a proprietary messaging format to manipulate
Dynamic HTML Dynamic HTML, or DHTML, is a collection of technologies used together to create interactive and animated website A website (also written as web site) is a collection of web pages and related content that is identified by a common domain name ...
elements (this system is also owned by 3DO). Upon discovery of early
Ajax Ajax (also AJAX ; short for "Asynchronous JavaScript JavaScript (), often abbreviated JS, is a programming language A programming language is a formal language comprising a Instruction set architecture, set of instructions that produ ...
capabilities, digiGroups, Noosh, and others used frames to pass information into the user browsers' visual field without refreshing a Web application's visual context, realizing real-time rich Web applications using only the standard HTTP, HTML and JavaScript capabilities of Netscape 4.0.5+ and IE 5+. Crockford first specified and popularized the JSON format. The State Software co-founders agreed to build a system that used standard browser capabilities and provided an
abstraction layerIn computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes and development of both computer hardware , hardware and software. ...
for Web developers to create stateful Web applications that had a persistent duplex connection to a Web server by holding two
Hypertext Transfer Protocol The Hypertext Transfer Protocol (HTTP) is an application layer An application layer is an abstraction layer that specifies the shared communications protocols and Interface (computing), interface methods used by Host (network), hosts in a c ...
(HTTP) connections open and recycling them before standard browser time-outs if no further data were exchanged. The co-founders had a round-table discussion and voted whether to call the data format JSML (JavaScript Markup Language) or JSON (JavaScript Object Notation), as well as under what
license A license (American English American English (AmE, AE, AmEng, USEng, en-US), sometimes called United States English or U.S. English, is the set of varieties of the English language native to the United States. Currently, American English ...
type to make it available.
Chip Morningstar Chip Morningstar is an American author, developer, software programmer and designer of software systems, mainly for online entertainment and communication. Morningstar held many jobs throughout his career in the research and development of technol ...
developed the idea for the State Application Framework at State Software. The system was sold to
Sun Microsystems Sun Microsystems, Inc. (Sun for short) was an American technology company that sold computer A computer is a machine that can be programmed to Execution (computing), carry out sequences of arithmetic or logical operations automatically. M ...
,
Amazon.com Amazon.com, Inc. ( ) is an American multinational Multinational may refer to: * Multinational corporation, a corporate organization operating in multiple countries * Multinational force, a military body from multiple countries * Multinational ...
and
EDSEDS or Eds may refer to: Organisations * Electronic Data Systems, a defunct American technology company Education * Episcopal Divinity School, an Episcopal Seminary in Cambridge, Massachusetts, US * Evansville Day School, an independent college-pre ...
. The JSON.org website was launched in 2002. In December 2005,
Yahoo! Yahoo (, styled as yahoo''!'') is an American web services The term Web service (WS) is either: * a service offered by an electronic device to another electronic device, communicating with each other via the World Wide Web, or * a server run ...
began offering some of its
Web service The term Web service (WS) is either: * a service offered by an electronic device to another electronic device, communicating with each other via the World Wide Web The World Wide Web (WWW), commonly known as the Web, is an information ...
s in JSON. JSON was based on a
subset In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). ...

subset
of the
JavaScript JavaScript (), often abbreviated JS, is a programming language A programming language is a formal language comprising a Instruction set architecture, set of instructions that produce various kinds of Input/output, output. Programming lang ...

JavaScript
scripting language (specifically, Standard ECMA-262 3rd Edition—December 1999) and is commonly used with JavaScript, but it is a language-independent data format. Code for
parsing Parsing, syntax analysis, or syntactic analysis is the process of analyzing a string String or strings may refer to: *String (structure), a long flexible structure made from threads twisted together, which is used to tie, bind, or hang other obje ...

parsing
and generating JSON data is readily available in many
programming languages A programming language is a formal language comprising a set of Formal language#Words over an alphabet, strings that produce various kinds of Machine code, machine code output. Programming languages are one kind of computer language, and are us ...
. JSON's website lists JSON
libraries A library is a collection of materials, books or media that are easily accessible for use and not just for display purposes. It is responsible for housing updated information in order to meet the user's needs on a daily basis. A library provi ...
by language. In October 2013,
Ecma International Ecma International () is a Nonprofit organization, nonprofit standards organization for information and communication systems. It acquired its current name in 1994, when the European Computer Manufacturers Association (ECMA) changed its name to ...
published the first edition of its JSON standard ECMA-404. That same year, used ECMA-404 as a reference. In 2014, became the main reference for JSON's Internet uses, superseding and (but preserving ECMA-262 and ECMA-404 as main references). In November 2017,
ISO/IEC JTC 1/SC 22ISO/IEC JTC 1/SC 22 Programming languages, their environments and system software interfaces is a standardization subcommittee of the Joint Technical Committee ISO/IEC JTC1, ISO/IEC JTC 1 of the International Organization for Standardization (ISO) an ...
published ISO/IEC 21778:2017 as an international standard. On 13 December 2017, the
Internet Engineering Task Force The Internet Engineering Task Force (IETF) is an open standards organization, which develops and promotes voluntary Internet standards, in particular the technical standards that comprise the Internet protocol suite (TCP/IP). It has no formal ...
obsoleted when it published , which is the current version of the
Internet Standard An Internet Standard in computer network engineering refers to the normative specification of a technology that is appropriate for the Internet. Internet Standards allow interoperation of hardware and software from different sources which allows th ...
STD 90. Crockford added a clause to the JSON license stating that "The Software shall be used for Good, not Evil," in order to
open-source Open source is source code that is made freely available for possible modification and redistribution. Products include permission to use the source code, design documents, or content of the product. The open-source model is a decentralized softwar ...
the JSON libraries while mocking corporate lawyers and those who are overly pedantic. On the other hand, this clause led to
license compatibility License compatibility is a legal framework that allows for pieces of software with different software licenses to be distributed together. The need for such a framework arises because the different licenses can contain contradictory requirements ...
problems of the JSON license with other
open-source license An open-source license is a type of License compatibility, license for computer software and other products that allows the source code, blueprint or design to be used, modified and/or shared under defined terms and conditions. This allows end user ...
s, as
open-source software Open-source software (OSS) is computer software Software is a collection of instructions Instruction or instructions may refer to: Computing * Instruction, one operation of a processor within a computer architecture instruction set * Co ...
and
free software Free software (or libre software) is computer software distributed under terms that allow users to run the software for any purpose as well as to study, change, and distribute it and any adapted versions. Free software is a matter of liberty ...

free software
usually imply no restrictions on the purpose of use.


Syntax

The following example shows a possible JSON representation describing a person.


Character encoding

Although Crockford originally asserted and believed that JSON is a strict subset of JavaScript and ECMAScript, his specification actually allows valid JSON documents that are not valid JavaScript; JSON allows the Unicode line terminators and to appear unescaped in quoted strings, while ECMAScript 2018 and older does not. This is a consequence of JSON disallowing only "control characters". For maximum portability, these characters should be backslash-escaped. JSON exchange in an open ecosystem must be encoded in
UTF-8 UTF-8 is a variable-width character encoding Character encoding is the process of assigning numbers to Graphics, graphical character (computing), characters, especially the written characters of Language, human language, allowing them to be ...
. The encoding supports the full Unicode character set, including those characters outside the
Basic Multilingual Plane In the Unicode Unicode, formally the Unicode Standard, is an information technology standard Standard may refer to: Flags * Colours, standards and guidons * Standard (flag), a type of flag used for personal identification Norm, conventi ...
(U+10000 to U+10FFFF). However, if escaped, those characters must be written using UTF-16 surrogate pairs. For example, to include the
Emoji An emoji ( ; plural emoji or emojis) is a pictogram A pictogram, also called a pictogramme, pictograph, or simply picto, and in computer usage an icon An icon (from the Greek language, Greek 'image, resemblance') is a religious wor ...

Emoji
character in JSON: // or JSON became a strict subset of ECMAScript as of the language's 2019 revision.


Data types

JSON's basic data types are: * Number: a signed decimal number that may contain a fractional part and may use exponential
E notation Scientific notation is a way of expressing real numbers, numbers that are too large or too small (usually would result in a long string of digits) to be conveniently written in decimal form. It may be referred to as scientific form or standard in ...
, but cannot include non-numbers such as
NaN In computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes and development of both computer hardware , hardware and softwar ...

NaN
. The format makes no distinction between integer and floating-point. JavaScript uses a
double-precision floating-point format Double-precision floating-point format (sometimes called FP64 or float64) is a computer number format, usually occupying 64 Bit, bits in computer memory; it represents a wide dynamic range of numeric values by using a floating radix point. Floating ...
for all its numeric values (until later also supports BigInt), but other languages implementing JSON may encode numbers differently. *
String String or strings may refer to: *String (structure), a long flexible structure made from threads twisted together, which is used to tie, bind, or hang other objects Arts, entertainment, and media Films * Strings (1991 film), ''Strings'' (1991 fil ...
: a sequence of zero or more
Unicode Unicode, formally the Unicode Standard, is an information technology Technical standard, standard for the consistent character encoding, encoding, representation, and handling of Character (computing), text expressed in most of the world's wri ...

Unicode
characters. Strings are delimited with double-quotation marks and support a backslash escaping syntax. * Boolean: either of the values true or false *
Array ARRAY, also known as ARRAY Now, is an independent distribution company launched by film maker and former publicist Ava DuVernay Ava Marie DuVernay (; born August 24, 1972) is an American filmmaker. She won the directing award in the U.S. dram ...
: an ordered list of zero or more elements, each of which may be of any type. Arrays use
square bracket In Euclidean geometry Euclidean geometry is a mathematical system attributed to Alexandrian Greek mathematics , Greek mathematician Euclid, which he described in his textbook on geometry: the ''Euclid's Elements, Elements''. Euclid's method c ...
notation with comma-separated elements. *
Object Object may refer to: General meanings * Object (philosophy), a thing, being, or concept ** Entity, something that is tangible and within the grasp of the senses ** Object (abstract), an object which does not exist at any particular time or pl ...
: a collection of name–value pairs where the names (also called keys) are strings. The current ECMA standard states: "The JSON syntax does not impose any restrictions on the strings used as names, does not require that name strings be unique, and does not assign any significance to the ordering of name/value pairs." Objects are delimited with
curly brackets A bracket is either of two tall fore- or back-facing punctuation Punctuation (or sometimes interpunction) is the use of spacing, conventional signs (called punctuation marks), and certain typographical devices as aids to the understanding ...

curly brackets
and use commas to separate each pair, while within each pair the colon ':' character separates the key or name from its value. * null: an empty value, using the word null
Whitespace White space or whitespace may refer to: Technology * Whitespace character, Whitespace characters, characters in computing that represent horizontal or vertical space * White spaces (radio), allocated but locally unused radio frequencies * TV White ...
is allowed and ignored around or between syntactic elements (values and punctuation, but not within a string value). Four specific characters are considered whitespace for this purpose:
space Space is the boundless three-dimensional Three-dimensional space (also: 3-space or, rarely, tri-dimensional space) is a geometric setting in which three values (called parameter A parameter (from the Ancient Greek language, Ancient Gre ...

space
,
horizontal tab Image:Keyboard-left keys.jpg, Tab key (top left) on a standard Windows keyboard The tab key (abbreviation of tabulator key or tabular key) on a alphanumeric keyboard, keyboard is used to advance the cursor to the next tab stop. History The wo ...
,
line feed Newline (frequently called line ending, end of line (EOL), next line (NEL) or line break) is a control character In computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includ ...
, and
carriage return A carriage return, sometimes known as a cartridge return and often shortened to CR, or return, is a control character In computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It inclu ...
. In particular, the byte order mark must not be generated by a conforming implementation (though it may be accepted when parsing JSON). JSON does not provide syntax for comments. Early versions of JSON (such as specified by ) required that a valid JSON text must consist of only an object or an array type, which could contain other types within them. This restriction was dropped in , where a JSON text was redefined as any serialized value. Numbers in JSON are agnostic with regard to their representation within programming languages. While this allows for numbers of arbitrary precision to be serialized, it may lead to portability issues. For example, since no differentiation is made between integer and floating-point values, some implementations may treat 42, 42.0, and 4.2E+1 as the same number, while others may not. The JSON standard makes no requirements regarding implementation details such as overflow, underflow, loss of precision, rounding, or signed zeros, but it does recommend to expect no more than
IEEE 754 The IEEE Standard for Floating-Point Arithmetic (IEEE 754) is a technical standard A technical standard is an established norm Norm, the Norm or NORM may refer to: In academic disciplines * Norm (geology), an estimate of the idealised mineral ...
binary64 Double-precision floating-point format (sometimes called FP64 or float64) is a , usually occupying 64 in computer memory; it represents a wide of numeric values by using a floating . Floating point is used to represent fractional values, or when ...
precision for "good interoperability". There is no inherent precision loss in serializing a machine-level binary representation of a floating-point number (like binary64) into a human-readable decimal representation (like numbers in JSON), and back, since there exist published algorithms to do this exactly and optimally. Comments were intentionally excluded from JSON. In 2012, Douglas Crockford described his design decision thus: "I removed comments from JSON because I saw people were using them to hold parsing directives, a practice which would have destroyed interoperability." JSON disallows "trailing commas", a
comma The comma is a punctuation Punctuation (or sometimes interpunction) is the use of spacing, conventional signs (called punctuation marks), and certain typographical devices as aids to the understanding and correct reading of written text, ...

comma
after the last value inside a data structure. Trailing commas are a common feature of JSON derivatives to improve ease of use.


Semantics

While JSON provides a syntactic framework for data interchange, unambiguous data interchange also requires agreement between producer and consumer on the semantics of specific use of the JSON syntax. One example of where such an agreement is necessary is the serialization of data types defined by the
JavaScript syntax The Syntax (programming languages), syntax of JavaScript is the set of rules that define a correctly structured JavaScript program. The examples below make use of the log function of the console object present in most browsers for Standard stream ...
that are not part of the JSON standard, e.g., Date, Function, Regular Expression, and undefined.


Metadata and schema

The official
MIME type A media type (formerly known as MIME type) is a two-part identifier for file formats and format contents transmitted on the Internet. The Internet Assigned Numbers Authority, Internet Assigned Numbers Authority (IANA) is the official authority for ...
for JSON text is "application/json", and most modern implementations have adopted this. The unofficial MIME type "text/json" or the content-type "text/javascript" are also supported for legacy reasons by many service providers, browsers, servers, web applications, libraries, frameworks, and APIs. Notable examples include the Google Search API, Yahoo!, Flickr, Facebook API, Lift framework, and Dojo Toolkit 0.4. ''JSON Schema'' specifies a JSON-based format to define the structure of JSON data for validation, documentation, and interaction control. It provides a contract for the JSON data required by a given application, and how that data can be modified. JSON Schema is based on the concepts from
XML Schema #REDIRECT XML schema#REDIRECT XML schema An XML schema is a description of a type of XML document, typically expressed in terms of constraints on the structure and content of documents of that type, above and beyond the basic syntactical constra ...
(XSD), but is JSON-based. As in XSD, the same serialization/deserialization tools can be used both for the schema and data, and it is self-describing. It is specified in an
Internet Draft An Internet Draft (I-D) is a document published by the Internet Engineering Task Force The Internet Engineering Task Force (IETF) is an open standards organization, which develops and promotes voluntary Internet standards, in particular the ...
at the IETF, currently in 2020-12 draft, which was released on January 28, 2021. There are several validators available for different programming languages, each with varying levels of conformance. There is no standard filename extension. The JSON standard does not support object
references Reference is a relationship between objects in which one object designates, or acts as a means by which to connect to or link to, another object. The first object in this relation is said to ''refer to'' the second object. It is called a ''name ...
, but an
IETF The Internet Engineering Task Force (IETF) is an open standards organization A standards organization, standards body, standards developing organization (SDO), or standards setting organization (SSO) is an organization whose primary functi ...
draft standard for JSON-based object references exists. The
Dojo Toolkit Dojo Toolkit (stylized as dōjō toolkit) is an open-source modular JavaScript library A JavaScript library is a library A library is a curated collection of sources of information and similar resources, made accessible to a defined communit ...
supports object references using standard JSON; specifically, the dojox.json.ref module provides support for several forms of referencing including
circular Circular may refer to: * The shape of a circle * Circular (album), ''Circular'' (album), a 2006 album by Spanish singer Vega * Circular letter (disambiguation) ** Flyer (pamphlet), a form of advertisement * Circular reasoning, a type of logical fa ...

circular
, multiple, inter-message, and lazy referencing. Internally both do so by assigning a key for such references and resolving it at parse-time; the IETF draft only specifies the URL syntax, but Dojo allows more. Alternatively, non-standard solutions exist such as the use of Mozilla JavaScript Sharp Variables. However this functionality became obsolete with JavaScript 1.8.5 and was removed in Firefox version 12.


Uses

JSON-RPC is a
remote procedure call#REDIRECT remote procedure call In distributed computing, a remote procedure call (RPC) is when a computer program causes a procedure ( subroutine) to execute in a different address space (commonly on another computer on a shared network), which is ...
(RPC) protocol built on JSON, as a replacement for
XML-RPC XML-RPC is a remote procedure call (RPC) Communications protocol, protocol which uses XML to encode its calls and HTTP as a transport mechanism.Simon St. Laurent, Joe Johnston, Edd Dumbill. (June 2001) ''Programming Web Services with XML-RPC.'' ...
or
SOAP Soap is a salt (chemistry), salt of a fatty acid used in a variety of cleansing and lubricating products. In a domestic setting, soaps are surfactants usually used for washing, bathing, and other types of housekeeping. In industrial settings, ...

SOAP
. It is a simple protocol that defines only a handful of data types and commands. JSON-RPC lets a system send notifications (information to the server that does not require a response) and multiple calls to the server that can be answered out of order. Asynchronous JavaScript and JSON (or AJAJ) refers to the same dynamic web page methodology as
Ajax Ajax (also AJAX ; short for "Asynchronous JavaScript JavaScript (), often abbreviated JS, is a programming language A programming language is a formal language comprising a Instruction set architecture, set of instructions that produ ...
, but instead of XML, JSON is the data format. AJAJ is a web development technique that provides for the ability of a webpage to request new data after it has loaded into the web browser. Typically it renders new data from the server in response to user actions on that webpage. For example, what the user types into a Text box, search box, Client-side scripting, client-side code then sends to the server, which immediately responds with a drop-down list of matching database items. While JSON is a data serialization format, it has seen ad hoc usage as a configuration file, configuration language. In this use case, support for comments and other features have been deemed useful, which has led to several nonstandard JSON supersets being created. Among them are HJSON, HOCON, and JSON5 (which despite its name, isn't the fifth version of JSON). The primary objective of version 1.2 of YAML was to make the nonstandard format a strict JSON superset. In 2012, Douglas Crockford had this to say about comments in JSON when used as a configuration language: "I know that the lack of comments makes some people sad, but it shouldn't. Suppose you are using JSON to keep configuration files, which you would like to annotate. Go ahead and insert all the comments you like. Then pipe it through JSMin before handing it to your JSON parser." JSON is intended as a data serialization format. However, its design as a subset of JavaScript can lead to the misconception that it is safe to pass JSON texts to the JavaScript function. This is not safe, due to certain valid JSON texts, specifically those containing or , not being valid JavaScript code until JavaScript specifications were updated in 2019, and so older engines may not support it. To avoid the many pitfalls caused by executing arbitrary code from the Internet, a new function, was first added to the fifth edition of ECMAScript, which as of 2017 is supported by all major browsers. For non-supported browsers, an API-compatible JavaScript library is provided by
Douglas Crockford Douglas Crockford is an United States, American computer programmer and entrepreneur who is involved in the development of the JavaScript language. He popularized the data format JSON (JavaScript Object Notation), and has developed various JavaScr ...

Douglas Crockford
. In addition, the TC39 proposa
"Subsume JSON"
made ECMAScript a strict JSON superset as of the language's 2019 revision. Various JSON parser implementations have suffered from denial-of-service attack and mass assignment vulnerability.


Comparison with other formats

JSON is promoted as a low-overhead alternative to XML as both of these formats have widespread support for creation, reading, and decoding in the real-world situations where they are commonly used. Apart from XML, examples could include Comma-separated values, CSV and YAML (a superset of JSON). Also, Protocol Buffers, Google Protocol Buffers can fill this role, although it is not a data interchange language.


YAML

YAML version 1.2 is a superset of JSON; prior versions were not strictly compatible. For example, escaping a slash with a backslash is valid in JSON, but was not valid in YAML. YAML supports comments, while JSON does not.


XML

XML has been used to describe structured data and to serialize objects. Various XML-based protocols exist to represent the same kind of data structures as JSON for the same kind of data interchange purposes. Data can be encoded in XML in several ways. The most expansive form using tag pairs results in a much larger representation than JSON, but if data is stored in attributes and 'short tag' form where the closing tag is replaced with , the representation is often about the same size as JSON or just a little larger. However, an XML attribute can only have a single value and each attribute can appear at most once on each element. XML separates "data" from "metadata" (via the use of elements and attributes), while JSON does not have such a concept. Another key difference is the addressing of values. JSON has objects with a simple "key" to "value" mapping, whereas in XML addressing happens on "nodes", which all receive a unique ID via the XML processor. Additionally, the XML standard defines a common attribute , that can be used by the user, to set an ID explicitly. XML tag names cannot contain any of the characters !"#$%&'()*+,/;<=>?@[\]^`~, nor a space character, and cannot begin with , , or a numeric digit, whereas JSON keys can (even if quotation mark and backslash must be escaped). XML values are strings of ''characters'', with no built-in type safety. XML has the concept of XML schema, schema, that permits strong typing, user-defined types, predefined tags, and formal structure, allowing for formal validation of an XML stream. JSON has strong typing built-in, and has a similar schema concept in JSON#Metadata and schema, JSON Schema. XML supports comments, while JSON does not.


Derivatives

Several serialisation formats have been built on or from the JSON specification. Examples include GeoJSON, JSON-LD, Smile (data interchange format), UBJSON, JSON-RPC, JsonML, and JSON→URL.


See also

* Comparison of data serialization formats * Amazon Ion (serialization format), Ion a superset of JSON * Jackson (API) * JSON streaming * S-expression


References


External links

* *
STD 90
JSON Data Interchange Format {{Authority control JSON, Computer-related introductions in 2001 Ajax (programming) Data serialization formats Ecma standards ISO standards Markup languages Configuration files Open formats Articles with example JavaScript code