Skip to content

JSON Type Definition

Peter edited this page Dec 1, 2017 · 6 revisions

Summary

Standard JSON-schemas used in the j attribute of dataset.big table.

name Description about
bag JSON Bag (multiset), pairs of element-multiplicity. For optimized access and specific operations. ref
tab-aoa JSON Tabular Array of Array-rows, one SQL field with all rows. Separated header. Best. ref
tab-1apr Tabular, distributed in many SQL rows, one JSON-array per SQL-row. ref
objs-free Objects, free-structure, all dataset in only one JSON set of objects. Non tabular (ex. free taxonomy)
json-ld JSON for Linking Data, W3C standard v1.0 of 2014 ref
tab-aoo JSON Tabular Array of Object-rows, one SQL field with all rows. Please avoid! prefer tab-aoa. ref
tab-1opr Tabular, distributed in many SQL rows, each row with an Object. Please avoid! prefer tab-1apr.
tab-aoa-trans1 A tab-aoa with Transactional-expenditure-data-v1 (see URL) semantics and its minimal structure. ref

The only valid JSON-schema for dataset.meta.info is the FrictionLessData/spec/data-package v1.0.

Other types, valid only for output:

name Description about
tabh-aoa tabh as "tab with header", for output. After header, same as tab-aoa. ref

Examples

All examples using near the same content, except non-tabular JTD.

bag

A typical list of sample-frequency in statistical data, or element-multiplicity in generalized sets.

{
  "maria": 909900,
  "josé": 9221,
  "carolina": 500
}

json-ld

{
  "@context": "http://schema.org/",
  "@type": "Person",
  "name": "Jane Doe",
  "jobTitle": "Professor",
  "telephone": "(425) 123-4567",
  "url": "http://www.janedoe.com"
}

Any valid JSON-LD.

objs-free

{
  "id": 123,
  "person": {
    "name": "Jane Doe",
    "jobTitle": "Professor",
    "telephone": "(425) 123-4567"
  },
  "url": "http://www.janedoe.com"
}

Non-tabular, no limits to hierarchical levels.

tab-1apr

At SQL, suppose 2 rows of dataset.big, and its JSONb attribute j,

row j
1 [ 1, 2, 3, "x" ]
2 [ 4, 5, 6, "y" ]

tab-1opr

At SQL, suppose 2 rows of dataset.big, and its JSONb attribute j,

row j
1 { "A":1, "B":2, "C":3, "S":"x" }
2 { "A":4, "B":5, "C":6, "S":"y" }

tab-aoa

[
  [ 1, 2, 3, "x" ],
  [ 4, 5, 6, "y" ]
]

The header stay at dataset.meta, indirectly at info or directly, cached as kx_fields. To output as tab-aoa-header use SELECT dataset.f(j).

tab-aoa-trans1

[
  [ "Prefeitura de Campinas", "2016-11-29", "XPTO suprimentos Ltda.", "ctr234", "545665", 
    "ab3456", "CGM - Controladoria Geral do Município"],
  [ "Prefeitura de Campinas", "2016-12-03", "Casas Bahia SA.", "ctr464", "736443", "bc1458", "CGM"]
]

tab-aoo

[
  { "A": 1, "B": 2, "C": 3, "S":"x" },
  { "A": 4, "B": 5, "C": 6, "S":"y" }
]

tab-aoo-trans1

[
 {"administrator":"Prefeitura de Campinas", "date":"2016-11-29", "supplier":"XPTO suprimentos Ltda.",
  "contract":"ctr234", "budgetLineItem":"545665", "invoiceID":"ab3456", 
  "procurer":"CGM - Controladoria Geral do Município"
 },
 {"administrator":"Prefeitura de Campinas", "date":"2016-12-03", "supplier":"Casas Bahia SA.",
  "contract":"ctr464", "budgetLineItem":"736443", "invoiceID":"bc1458", "procurer":"CGM"
 }
]

tabh-aoa

[
  [ "A", "B", "C", "S" ],
  [ 1, 2, 3, "x" ],
  [ 4, 5, 6, "y" ]
]

To change this page, change also this spreadsheets.

Clone this wiki locally