Skip to content

Instantly share code, notes, and snippets.

@brianv0
Last active March 17, 2016 00:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brianv0/07cf0acd83bde6f450a9 to your computer and use it in GitHub Desktop.
Save brianv0/07cf0acd83bde6f450a9 to your computer and use it in GitHub Desktop.
Example JSON output
{
"result": {
"table": {
"data": [
[
8404051561545729,
125230127
],
[
8404051561545730,
125230127
],
[
8404051561545731,
125230127
],
[
8404051561545732,
125230127
],
[
8404051561545733,
125230127
],
[
8404051561545734,
125230127
],
[
8404051561545735,
125230127
],
[
8404051561545736,
125230127
],
[
8404051561545737,
125230127
],
[
8404051561545738,
125230127
]
],
"metadata": {
"elements": [
{
"datatype": "long",
"name": "deepForcedSourceId"
},
{
"datatype": "long",
"name": "scienceCcdExposureId"
}
]
}
}
}
}
{
"result": {
"table": {
"metadata": {
"elements": [{
"$type": "field",
"name": "word",
"datatype": "text"
}, {
"$type": "field",
"name": "num",
"datatype": "integer"
}, {
"$type": "field",
"name": "largenum",
"datatype": "long"
}, {
"$type": "field",
"name": "time",
"datatype": "text",
"xtype": "timestamp"
}, {
"$type": "field",
"name": "raw",
"datatype": "binary"
}]
},
"data": [
["hello", 1, "12345678901234", "2015-01-01T12:00Z", "cmF3IGRhdGE="],
["world", 1, "98765432101234", "2016-01-01T12:00Z", "bW9yZSByYXcgZGF0YQ=="],
]
}
}
}

Recommended type names

  • bool
  • byte (1)
  • short (2)
  • int
  • long
  • float (2)
  • double

Array types

  • binary (must be base64 encoded)
  • text (3)

xtypes

These are compatible with text or binary type.

  • timestamp (alt. adql:TIMESTAMP)

adql xtypes

Note: Prefer text or binary over adql:CLOB/adql:BLOB.

  • adql.POINT
  • adql.REGION

Notes:

  1. In practice, database responses will only use binary type
  2. Not likely to be used over larger types much in practice
  3. JSON mandates UTF-8 (default), UTF-16, or UTF-32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment