Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Group info
Members: 199
Language: English
Group categories:
Computers > Programming
More group info »
Recent pages and files
Json Schema Possible Formats    

JSON Schema Possible Formats

A JSON Schema may define a format in property definitions. This allows the format attribute to be used to define the type of data, content type, or microformat to be expected in the instance property values. A format attribute may be one of the values listed on this page, and if so, should adhere to the semantics describing for the format. A format should only be used give meaning to primitive types (string, integer, number, or boolean). Validators are not required to validate that the instance values conform to a format, and MAY only generate warnings about non-conformance, unless an instance value violates a condition that is stated in the format definition below with the "MUST" wording, at which point it SHOULD generate an error. Common definitions of objects or arrays will be referred to using JSON referencing (not the format attribute) and the list of shared definitions can be found here.

  • Any valid MIME media type may be used as a format value, in which case the instance property value must be a string, representing the contents of the MIME file. 
  • attachment
    This is a MIME attachment with the headers. This is included for the purposes of efficient transfer of binary files (using base64) with JSON string values, and attachment naming. The following is an example of an attachment value:
    "Content-Type: audio/wav;\\ name=voice_message_229.wav\\ Content-Transfer-Encoding: base64\\ Content-Disposition: attachment;\\ filename=sound.wav\\ \\ UklGRnorAABXQVZFZm...";
  • date-time
    This MUST be a date in ISO 8601 format of YYYY-MM-DDThh:mm:ssZ in UTC time. This is the JSON standard and recommended form of date/timestamp. The type of value must be a string.
  • date
    This should be a date in the format of YYYY-MM-DD. It is recommended that you use the "date-time" format instead of "date" unless you need to transfer only the date part. The type of value must be a string.
  • time
    This should be a time in the format of hh:mm:ss. It is recommended that you use the "date-time" format instead of "time" unless you need to transfer only the time part. The type of value must be a string.
  • utc-millisec
    This should be the difference, measured in milliseconds, between the specified time
    and midnight, January 1, 1970 UTC. The value must be a number (integer or float).
  • regex
    A regular expression.
  • color
    This is a CSS color (like "#FF0000" or "red").
  • style
    This is a CSS style definition (like "color: red; background-color:#FFF").
  • phone
    This should be a phone number (format may follow E.123). This value must be a string.
  • uri
    This should be a URI (that is it should be a url or urn). The value must be a string.
  • url
    This should be a URL. Relative urls should be allowed and when possible, should be resolved relative the url used to retrieve the instance data. The value must be a string.
  • email
    This should be an email address.
  • image
    This should be an image-ref or image-attachment. The value must be a string.
  • image-ref
    This should be a URL that references an image. The value must be a string.
  • image-attachment
    This should be a MIME attachment with an image as the attachment. The value must be a string.
  • ip-address
    This should be an ip version 4 address.
  • ipv6
    This should be an ip version 6 address.
  • urn
    This should be a URN. The value must be a string.
  • street-address
    This should be a street address.
  • locality
    This should be a city or town.
  • region
    This should be a region (a state in the US, province in Canada, etc.)
  • postal-code
    This should be a postal code (AKA zip code).
  • country
    This should be the name of a country.
  • Additional custom formats may be defined with a URL to a definition of the format.
Version: 
Latest 3 messages about this page (10 total) - view full discussion
Jan 23 2008 by David Waite
I had a few different ideas:
- time specific
- datetime, date - same as above
- timestamp - offset in seconds since jan 1, 1970 at 12:00
midnight in zulu time, adjusted per UTC rules. May be a
floating point number. similar to utc-millisec, but in
Jan 8 2008 by Kris Zyp
The whole "format" attribute is really in flux in mind right now. I am
really wondering if I should just drop "format" as a validating attribute ,
and reserve it purely for indicating MIME types, and then use JSON
referencing to utilize shared/common schema definitions. More later on that,
just wanted to let you know what I am thinking.
Jan 7 2008 by Claudio D'angelo
Very well,
but the schema specification must supply the structure for these formats.
SMM ha scritto:
7 more messages »
Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2010 Google