The application/json Media Type for JavaScript Object Notation (JSON)
draft-crockford-jsonorg-json-04

The information below is for an old version of the document that is already published as an RFC
Document Type RFC Internet-Draft (individual in app area)
Author Douglas Crockford 
Last updated 2020-01-21 (latest revision 2006-03-03)
Replaces draft-jsonorg-json
Stream IETF stream
Formats plain text pdf htmlized (tools) htmlized bibtex
Additional Resources
Stream WG state (None)
Document shepherd No shepherd assigned
IESG IESG state RFC 4627 (Informational)
Consensus Boilerplate Unknown
Telechat date
Responsible AD Lisa Dusseault
Send notices to (None)
JavaScript Object Notation (JSON)                           D. Crockford
Internet Draft                                                  JSON.org
draft-crockford-jsonorg-json-04.txt                       February, 2006
Intended status: Informational
Expires: June 10, 2006

                    JavaScript Object Notation (JSON)

Status of this Memo

   This document may not be modified, and derivative works of it
   may not be created, except to publish it as an RFC and to
   translate it into languages other than English.

   By submitting this Internet-Draft, each author represents that any
   applicable patent or other IPR claims of which he or she is aware
   have been or will be disclosed, and any of which he or she becomes
   aware will be disclosed, in accordance with Section 6 of BCP 79.

   Internet-Drafts are working documents of the Internet Engineering
   Task Force (IETF), its areas, and its working groups.  Note that
   other groups may also distribute working documents as
   Internet-Drafts.

   Internet-Drafts are draft documents valid for a maximum of six months
   and may be updated, replaced, or obsoleted by other documents at any
   time.  It is inappropriate to use Internet-Drafts as reference
   material or to cite them other than as "work in progress."

   The list of current Internet-Drafts can be accessed at
   http://www.ietf.org/ietf/1id-abstracts.txt.

   The list of Internet-Draft Shadow Directories can be accessed at
   http://www.ietf.org/shadow.html.

   This Internet Draft will expire on June 10, 2006.

Copyright Notice

   Copyright (C) The Internet Society (2006).

Abstract

   JavaScript Object Notation (JSON) is a light-weight, text-based,
   language-independent, data interchange format.  It was derived from
   the ECMAScript Programming Language Standard.  JSON defines a small
   set of formatting rules for the portable representation of structured
   data.

Conventions used in this document

   The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
   "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
   document are to be interpreted as described in [RFC-2119].

   The grammatical rules in this document are to be interpreted as
   described in [RFC-4234].

1. Introduction

   JavaScript Object Notation (JSON) is a text format for the
   serialization of structured data.  It is derived from the object
   literals of JavaScript, as defined in the ECMAScript
   Programming Language Standard, Third Edition [ECMA].

   JSON can represent four primitive types (strings, numbers, booleans,
   and null) and two structured types (objects and arrays).

   A string is a sequence of zero or more Unicode characters [UNICODE].

   An object is an unordered collection of zero or more name/value
   pairs, where a name is a string, and a value is a string, number,
   boolean, null, object, or array.

   An array is an ordered sequence of zero or more values.

   The terms "object" and "array" come from the conventions of
   JavaScript.

   JSON's design goals were to be minimal, portable, textual, and a
   subset of JavaScript.

2. JSON Grammar

   A JSON text is a sequence of tokens.  The set of tokens includes six
   structural characters, strings, numbers, and three literal names.

   A JSON text is a serialized object or array.

      JSON-text = object / array

   These are the six structural characters:

      begin-array     = ws %x5B ws  ; [ left square bracket

      begin-object    = ws %x7B ws  ; { left curly bracket

      end-array       = ws %x5D ws  ; ] right square bracket

      end-object      = ws %x7D ws  ; } right curly bracket

      name-separator  = ws %x3A ws  ; : colon

      value-separator = ws %x2C ws  ; , comma

   Insignificant whitespace is allowed before or after any of the six
   structural characters.

      ws = *(
                %x20 /              ; Space
                %x09 /              ; Horizontal tab
                %x0A /              ; Line feed or New line
                %x0D                ; Carriage return
            )

   2.1. Values

      A JSON value MUST be a object, array, number, or string, or one of
      the three literal names:

         false
         null
         true

      The literal names MUST be in lower case.  No other literal names
      are allowed.

         value = false / null / true / object / array / number / string

         false = %x66.61.6c.73.65   ; false

         null  = %x6e.75.6c.6c      ; null

         true  = %x74.72.75.65      ; true

   2.2. Objects

      An object structure is represented as a pair of curly brackets
      surrounding zero or more name/value pairs (or members).  A name is
      a string.  A single colon comes after each name, separating the
      name from the value.  A single comma separates a value from a
      following name. The names within an object SHOULD be unique.

         object = begin-object [ member *( value-separator member ) ]
                  end-object
Show full document text