JSON comparison chart

This chart compares styles of JSON Schema generation:

The differences between JSON Schema styles are:

  1. WAPI and SWIFT use an abbreviated snake case form of the Message Definition’s name as the top object property. MixedType and StringArray use the verbatim Root Element as modelled & provide the verbatim name in a @name property.
  2. WAPI uses @xmlns, and SWIFT use $id to hold an xmlns with a URN concatenating the Message Definition Identifier. MixedType and StringArray provide identifier components in separate properties.
  3. WAPI and SWIFT do not include descriptions in the JSON Schema.
    MixedType and StringArray provide descriptions and omit the extraneous type, which is defined by the referenced item “$ref”.
  4. MixedType encodes numbers as JSON Numbers.
    Be aware that some JSON libraries do not handle big decimals.
  5. StringArray represents every element as an array of objects or strings, including Booleans. This has the benefit of providing consistent access to items irrespective of their multiplicity or type.
  6. SWIFT omits the minItems in arrays.
  7. SWIFT represents Element names in lower_snake_case.

The differences between JSON±LD SHACL & JSON Schema styles are:

  1. JSON±LD is a seriliasation of an RDF graph model.
  2. In order for SHACL to check the shape of the graph:
    • It requires a @vocab in a @context to specify members namespace.
    • The message objects’s @type is the message definition identifier.
    • It interprets a JSON array as links to each value in the array,
      so it doesn’t matter whether a single value is in an array or not.
  3. JSON numbers are interpreted by JSON+LD as decimal,
    whereas JSON-LD treats them as binary floats, losing accuracy.
    Representing a decimal number in JSON-LD requires a value object.

JSON±LD supports prefixes as abbreviations of namespaces, whereas
JSON Schema doesn’t handle namespaces. Provided the prefix is fixed,
it is possible to generate JSON Schema that validate JSON±LD.