Skip to content
This repository was archived by the owner on Dec 22, 2023. It is now read-only.

Protocol DataType

Rick Mak edited this page Apr 7, 2017 · 1 revision

Data Types

Data values is transformed to JSON according to their type. Types undefined in JSON will be serialized as JSON object with non-standard syntax.

type json type example
string string "data"
number number 42
boolean boolean true
array array [42, 43, 44]
dictionary object {"state": "happy"}
reference object {"$type": "ref", "$id": "RECORD_ID", "$class": "food"}
geolocation object {"$type": "geo", "$lat": 40.689167, "$lng": -74.044444}
datetime object {"$type": "date", "$date": "2015-02-02T01:43:19+00:00"}
data object {"$type": "blob", "$data": "...", "$enc": "base64"}

Non-standard Types

Non-standard types are specified as a JSON object with a special $type key which signify that the object should be treated as a value of non-standard type. More keys in the JSON object specifies the actual value.

  • ref: Value is a reference to another record.

    • $id: Record ID of the record being referenced.
    • $class: Class (Record Type) of the record being referenced.
  • geo: Value is a geographical coordinate.

    • $lat: Latitude
    • $lng: Longitude
  • date: Value is a date/time.

    • $date: Date in ISO 8601 format.
  • blob: Value is binary data.

    • $data: Encoded binary data.
    • $enc: Binary encoding format.

Clone this wiki locally

⌂ 换网址