background preloader

JSON

Facebook Twitter

JSON. JSON (/ˈdʒeɪsən/ JAY-sən),[1] or JavaScript Object Notation, is an open standard format that uses human-readable text to transmit data objects consisting of attribute–value pairs.

JSON

It is used primarily to transmit data between a server and web application, as an alternative to XML. Although originally derived from the JavaScript scripting language, JSON is a language-independent data format. Code for parsing and generating JSON data is readily available in many programming languages. The JSON format was originally specified by Douglas Crockford. It is currently described by two competing standards, RFC 7159 and ECMA-404. History[edit] Although JSON was originally based on a non-strict subset of the JavaScript scripting language (specifically, Standard ECMA-262 3rd Edition—December 1999[8]) and is commonly used with that language, it is a language-independent data format.

Data types, syntax and example[edit] JSON's basic types are: Data portability issues[edit] Using JSON in JavaScript[edit] The Fat-Free Alternative to XML. In 2005, the idea of Dynamic HTML gained new energy and acceptance when it was renamed as Ajax.

The Fat-Free Alternative to XML

One of the key ideas in Ajax is the use of data interchange as a more efficient alternative to page replacement. Applications are delivered as HTML pages. How should data be delivered? Historically, we have seen an evolution in data formats, from completely ad hoc methods to techniques that are inspired by database models and document models. The format that will be described here is based on a programming language model, avoiding the obvious brittleness of the ad hoc methods and the impedance mismatch inefficiencies of the other models.

JSON (or JavaScript Object Notation) is a programming language model data interchange format. JSON is not a document format. A number of people independently discovered that JavaScript's object literals were an ideal format for transmitting object-oriented data across the network. JSON is based on the object quasi-literals of JavaScript. <html>... Free Online JSON Formatter. Formats a JSON string/file with your desired indentation level creating an object tree with color highlights.

Free Online JSON Formatter

You can now clearly identify object constructs (objects, arrays and members). The JSON tree that is created can be navigated by collapsing the individual nodes one at a time if desired. *Files bigger than 1 meg will not be formatted to a tree structure for performance reason. They will instead be formatted to a plain text format. If you want to learn more about JSON, jump to the JSON Explained section of this page.

What is JSON? JSON stands for "JavaScript Object Notation" and is pronounced "Jason" (like in the Friday the 13th movies). Why use JSON? There are tons of reasons why you would want to use JSON:

JSON.Net

On the nightmare that is JSON Dates. Plus, JSON.NET and ASP.NET Web API. Example. This page shows examples of messages formatted using JSON (JavaScript Object Notation).

Example

The same text expressed as XML: <! DOCTYPE glossary PUBLIC "-//OASIS//DTD DocBook V3.1//EN"><glossary><title>example glossary</title><GlossDiv><title>S</title><GlossList><GlossEntry ID="SGML" SortAs="SGML"><GlossTerm>Standard Generalized Markup Language</GlossTerm><Acronym>SGML</Acronym><Abbrev>ISO 8879:1986</Abbrev><GlossDef><para>A meta-markup language, used to create markup languages such as DocBook. </para><GlossSeeAlso OtherTerm="GML"><GlossSeeAlso OtherTerm="XML"></GlossDef><GlossSee OtherTerm="markup"></GlossEntry></GlossList></GlossDiv></glossary> The same text expressed as XML: The same text expressed as XML: The same file expressed as XML: <?

The action and label values only need to be provided if they are not the same as the id. The same message expressed as XML: JSON.