Showing revision 2

Basic JData Examples

1. Constants and scalars

1. Constants and scalars

A numerical value is typically unchanged when converting to JData annotation, and is directly stored in the JSON/UBJSON numerical value forms. For example

Native data text-JData/JSON form binary-JData(UBJSON)
a=3
=>
{"a":3}
[{][U][1][a][U][3][}]

Similar for a floating point number

Native data text-JData/JSON form binary-JData(UBJSON) +
a=3.14159
=>
{"a":3.14159}
[{][U][1][a][D][3.15169][}]
+ In the case of the binary-JData, the type marker of the floating point number, here [D] must match the native data's type.

There are a few special constants, namely "NaN", "Infinity" and "-Infinity"

Native data text-JData/JSON form
a=nan
=>
{"a":"_NaN_"}
a=inf
=>
{"a":"_Inf_"}
a=-inf
=>
{"a":"-_Inf_"}

Three special constants are directly supported by the JSON/UBJSON specifications, these constants are logical "True", logical "False" and "Null", they are stored as

Native data text-JData/JSON form binary-JData(UBJSON)
a=true
=>
{"a":true}
[{][U][1][a][T][}]
a=false
=>
{"a":false}
[{][U][1][a][F][}]
a=null
=>
{"a":null}
[{][U][1][a][N][}]
Powered by Habitat