A Language for Rules Describing JSON Content
draft-newton-json-content-rules-00

The information below is for an old version of the document
Document Type Active Internet-Draft (individual)
Author Andrew Newton 
Last updated 2012-09-20
Stream (None)
Intended RFC status (None)
Formats pdf htmlized (tools) htmlized bibtex
Stream Stream state (No stream defined)
Consensus Boilerplate Unknown
RFC Editor Note (None)
IESG IESG state I-D Exists
Telechat date
Responsible AD (None)
Send notices to (None)
Network Working Group                                          A. Newton
Internet-Draft                                                      ARIN
Intended status: Standards Track                      September 20, 2012
Expires: March 24, 2013

              A Language for Rules Describing JSON Content
                   draft-newton-json-content-rules-00

Abstract

   This document describes a language useful for documenting the
   expected content of JSON structures.

Status of this Memo

   This Internet-Draft is submitted in full conformance with the
   provisions of BCP 78 and BCP 79.

   Internet-Drafts are working documents of the Internet Engineering
   Task Force (IETF).  Note that other groups may also distribute
   working documents as Internet-Drafts.  The list of current Internet-
   Drafts is at http://datatracker.ietf.org/drafts/current/.

   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."

   This Internet-Draft will expire on March 24, 2013.

Copyright Notice

   Copyright (c) 2012 IETF Trust and the persons identified as the
   document authors.  All rights reserved.

   This document is subject to BCP 78 and the IETF Trust's Legal
   Provisions Relating to IETF Documents
   (http://trustee.ietf.org/license-info) in effect on the date of
   publication of this document.  Please review these documents
   carefully, as they describe your rights and restrictions with respect
   to this document.  Code Components extracted from this document must
   include Simplified BSD License text as described in Section 4.e of
   the Trust Legal Provisions and are provided without warranty as
   described in the Simplified BSD License.

Newton                   Expires March 24, 2013                 [Page 1]
Internet-Draft             JSON Content Rules             September 2012

Table of Contents

   1.  Introduction . . . . . . . . . . . . . . . . . . . . . . . . .  3
   2.  Lines and Comments . . . . . . . . . . . . . . . . . . . . . .  7
   3.  Rules  . . . . . . . . . . . . . . . . . . . . . . . . . . . .  8
     3.1.  Value Rules  . . . . . . . . . . . . . . . . . . . . . . .  8
       3.1.1.  Numbers, Booleans and Null . . . . . . . . . . . . . .  8
       3.1.2.  Strings  . . . . . . . . . . . . . . . . . . . . . . .  9
     3.2.  Member Rules . . . . . . . . . . . . . . . . . . . . . . . 10
     3.3.  Object Rules . . . . . . . . . . . . . . . . . . . . . . . 11
     3.4.  Array Rules  . . . . . . . . . . . . . . . . . . . . . . . 12
     3.5.  Group Rules  . . . . . . . . . . . . . . . . . . . . . . . 14
     3.6.  Any Value and Any Member . . . . . . . . . . . . . . . . . 15
   4.  Directives . . . . . . . . . . . . . . . . . . . . . . . . . . 17
     4.1.  ignore-unknown-members . . . . . . . . . . . . . . . . . . 17
     4.2.  language-compatible-members  . . . . . . . . . . . . . . . 17
     4.3.  all-members-optional . . . . . . . . . . . . . . . . . . . 17
   5.  Formal Syntax  . . . . . . . . . . . . . . . . . . . . . . . . 18
   6.  Normative References . . . . . . . . . . . . . . . . . . . . . 19
   Appendix A.  Comparison with JSON Schema . . . . . . . . . . . . . 20
     A.1.  Example 1 from RFC 4627  . . . . . . . . . . . . . . . . . 20
     A.2.  Example 2 from RFC 4627  . . . . . . . . . . . . . . . . . 21
   Appendix B.  A "Real World" Exmaple  . . . . . . . . . . . . . . . 24
   Appendix C.  Design Notes  . . . . . . . . . . . . . . . . . . . . 27
     C.1.  Member Uniqueness  . . . . . . . . . . . . . . . . . . . . 27
     C.2.  Member Order . . . . . . . . . . . . . . . . . . . . . . . 27
     C.3.  Group Syntax for Arrays and Objects  . . . . . . . . . . . 27
     C.4.  Inspiration  . . . . . . . . . . . . . . . . . . . . . . . 27
   Author's Address . . . . . . . . . . . . . . . . . . . . . . . . . 28

Newton                   Expires March 24, 2013                 [Page 2]
Internet-Draft             JSON Content Rules             September 2012

1.  Introduction

   The goal of this document is to provide a way to document the
   expected content of data expressed in JSON [RFC4627] format.  That
   is, the primary purpose of this document is to specify a means for
   one person to communicate with another person the expected nature of
   a JSON data structure in a method more concise than prose.  The
   programmatic validation of a JSON data structure against content
   rules is a lesser goal of this document, though such a practice is
   useful in both the writing of specifications and the communications
   of programs.

   Unlike JSON Schema, this language is not JSON though the syntax
   described here is "JSON-like" (a comparison with JSON Schema can be
   found in Appendix A and a "real world" example can be found in
Show full document text