21. Boost package for JSON

The JSON boost module implements collection of helper macros and functions to accompany JSON.

All functions and symbols are in “json_boost” module, use require to get access to it.

require daslib/json_boost

21.1. Reader macros

json
This macro implements embedding of the JSON object into the program::

var jsv = %json~ {

“name”: “main_window”, “value”: 500, “size”: [1,2,3]

} %%

21.2. Variant macros

better_json

This macro is used to implement is json_value and as json_value runtime checks. It essencially substitutes value as name with value.value as name and value is name with value.value is name.

21.3. Value conversion

JV(v: float const)

JV returns json::JsonValue ?

argument

argument type

v

float const

skip functions skip void?

JV(v: int const)

JV returns json::JsonValue ?

argument

argument type

v

int const

skip functions skip void?

JV(v: bitfield const)

JV returns json::JsonValue ?

argument

argument type

v

bitfield<> const

skip functions skip void?

JV(val: int8 const)

JV returns json::JsonValue ?

argument

argument type

val

int8 const

skip functions skip void?

JV(val: uint8 const)

JV returns json::JsonValue ?

argument

argument type

val

uint8 const

skip functions skip void?

JV(val: int16 const)

JV returns json::JsonValue ?

argument

argument type

val

int16 const

skip functions skip void?

JV(val: uint16 const)

JV returns json::JsonValue ?

argument

argument type

val

uint16 const

skip functions skip void?

JV(val: uint const)

JV returns json::JsonValue ?

argument

argument type

val

uint const

skip functions skip void?

JV(val: int64 const)

JV returns json::JsonValue ?

argument

argument type

val

int64 const

skip functions skip void?

JV(val: uint64 const)

JV returns json::JsonValue ?

argument

argument type

val

uint64 const

skip functions skip void?

from_JV(v: JsonValue? const; ent: auto(EnumT) const; defV: EnumT const)

from_JV returns EnumT

argument

argument type

v

json::JsonValue ? const

ent

auto(EnumT) const

defV

EnumT const

Parse a JSON value and return the corresponding native value.

from_JV(v: JsonValue?; ent: string const; defV: string const)

from_JV returns auto

argument

argument type

v

json::JsonValue ?

ent

string const

defV

string const

Parse a JSON value and return the corresponding native value.

from_JV(v: JsonValue?; ent: bool const; defV: bool const)

from_JV returns auto

argument

argument type

v

json::JsonValue ?

ent

bool const

defV

bool const

Parse a JSON value and return the corresponding native value.

from_JV(v: JsonValue?; ent: float const; defV: float const)

from_JV returns auto

argument

argument type

v

json::JsonValue ?

ent

float const

defV

float const

Parse a JSON value and return the corresponding native value.

from_JV(v: JsonValue?; ent: double const; defV: double const)

from_JV returns auto

argument

argument type

v

json::JsonValue ?

ent

double const

defV

double const

Parse a JSON value and return the corresponding native value.

from_JV(v: JsonValue?; ent: int const; defV: int const)

from_JV returns auto

argument

argument type

v

json::JsonValue ?

ent

int const

defV

int const

Parse a JSON value and return the corresponding native value.

from_JV(v: JsonValue?; ent: uint const; defV: uint const)

from_JV returns auto

argument

argument type

v

json::JsonValue ?

ent

uint const

defV

uint const

Parse a JSON value and return the corresponding native value.

from_JV(v: JsonValue?; ent: int64 const; defV: int64 const)

from_JV returns auto

argument

argument type

v

json::JsonValue ?

ent

int64 const

defV

int64 const

Parse a JSON value and return the corresponding native value.

from_JV(v: JsonValue?; ent: uint64 const; defV: uint64 const)

from_JV returns auto

argument

argument type

v

json::JsonValue ?

ent

uint64 const

defV

uint64 const

Parse a JSON value and return the corresponding native value.

from_JV(v: JsonValue?; ent: int8 const; defV: int8 const)

from_JV returns auto

argument

argument type

v

json::JsonValue ?

ent

int8 const

defV

int8 const

Parse a JSON value and return the corresponding native value.

from_JV(v: JsonValue?; ent: uint8 const; defV: uint8 const)

from_JV returns auto

argument

argument type

v

json::JsonValue ?

ent

uint8 const

defV

uint8 const

Parse a JSON value and return the corresponding native value.

from_JV(v: JsonValue?; ent: int16 const; defV: int16 const)

from_JV returns auto

argument

argument type

v

json::JsonValue ?

ent

int16 const

defV

int16 const

Parse a JSON value and return the corresponding native value.

from_JV(v: JsonValue?; ent: uint16 const; defV: uint16 const)

from_JV returns auto

argument

argument type

v

json::JsonValue ?

ent

uint16 const

defV

uint16 const

Parse a JSON value and return the corresponding native value.

from_JV(v: JsonValue?; ent: bitfield const; defV: bitfield const)

from_JV returns auto

argument

argument type

v

json::JsonValue ?

ent

bitfield<> const

defV

bitfield<> const

Parse a JSON value and return the corresponding native value.

JV(v: auto(VecT) const)

JV returns auto

argument

argument type

v

auto(VecT) const

skip functions skip void?

from_JV(v: JsonValue?; ent: auto(VecT) const; defV: VecT const)

from_JV returns auto

argument

argument type

v

json::JsonValue ?

ent

auto(VecT) const

defV

VecT const

Parse a JSON value and return the corresponding native value.

from_JV(v: JsonValue?; anything: table<auto(KT);auto(VT)> const)

from_JV returns auto

argument

argument type

v

json::JsonValue ?

anything

table<auto(KT);auto(VT)> const

Parse a JSON value and return the corresponding native value.

from_JV(v: JsonValue?; anything: auto(TT) const)

from_JV returns auto

argument

argument type

v

json::JsonValue ?

anything

auto(TT) const

Parse a JSON value and return the corresponding native value.

JV(value: auto const)

JV returns json::JsonValue ?

argument

argument type

value

auto const

skip functions skip void?

JV(val1: auto const; val2: auto const)

JV returns json::JsonValue ?

argument

argument type

val1

auto const

val2

auto const

skip functions skip void?

JV(val1: auto const; val2: auto const; val3: auto const)

JV returns json::JsonValue ?

argument

argument type

val1

auto const

val2

auto const

val3

auto const

skip functions skip void?

JV(val1: auto const; val2: auto const; val3: auto const; val4: auto const)

JV returns json::JsonValue ?

argument

argument type

val1

auto const

val2

auto const

val3

auto const

val4

auto const

skip functions skip void?

JV(val1: auto const; val2: auto const; val3: auto const; val4: auto const; val5: auto const)

JV returns json::JsonValue ?

argument

argument type

val1

auto const

val2

auto const

val3

auto const

val4

auto const

val5

auto const

skip functions skip void?

JV(val1: auto const; val2: auto const; val3: auto const; val4: auto const; val5: auto const; val6: auto const)

JV returns json::JsonValue ?

argument

argument type

val1

auto const

val2

auto const

val3

auto const

val4

auto const

val5

auto const

val6

auto const

skip functions skip void?

JV(val1: auto const; val2: auto const; val3: auto const; val4: auto const; val5: auto const; val6: auto const; val7: auto const)

JV returns json::JsonValue ?

argument

argument type

val1

auto const

val2

auto const

val3

auto const

val4

auto const

val5

auto const

val6

auto const

val7

auto const

skip functions skip void?

JV(val1: auto const; val2: auto const; val3: auto const; val4: auto const; val5: auto const; val6: auto const; val7: auto const; val8: auto const)

JV returns json::JsonValue ?

argument

argument type

val1

auto const

val2

auto const

val3

auto const

val4

auto const

val5

auto const

val6

auto const

val7

auto const

val8

auto const

skip functions skip void?

JV(val1: auto const; val2: auto const; val3: auto const; val4: auto const; val5: auto const; val6: auto const; val7: auto const; val8: auto const; val9: auto const)

JV returns json::JsonValue ?

argument

argument type

val1

auto const

val2

auto const

val3

auto const

val4

auto const

val5

auto const

val6

auto const

val7

auto const

val8

auto const

val9

auto const

skip functions skip void?

JV(val1: auto const; val2: auto const; val3: auto const; val4: auto const; val5: auto const; val6: auto const; val7: auto const; val8: auto const; val9: auto const; val10: auto const)

JV returns json::JsonValue ?

argument

argument type

val1

auto const

val2

auto const

val3

auto const

val4

auto const

val5

auto const

val6

auto const

val7

auto const

val8

auto const

val9

auto const

val10

auto const

skip functions skip void?

21.4. Uncategorized

operator ?[](a: JsonValue? const ==const; key: string const)

?[] returns json::JsonValue ? const

argument

argument type

a

json::JsonValue ? const!

key

string const

Returns the value of the index in the JSON array, if it exists.

operator ?[](a: JsonValue? ==const; key: string const)

?[] returns json::JsonValue ?

argument

argument type

a

json::JsonValue ?!

key

string const

Returns the value of the index in the JSON array, if it exists.

operator ?.(a: JsonValue? const ==const; key: string const)

?. returns json::JsonValue ? const

argument

argument type

a

json::JsonValue ? const!

key

string const

Returns the value of the key in the JSON object, if it exists.

operator ?.(a: JsonValue? ==const; key: string const)

?. returns json::JsonValue ?

argument

argument type

a

json::JsonValue ?!

key

string const

Returns the value of the key in the JSON object, if it exists.

operator ?[](a: JsonValue? const ==const; idx: int const)

?[] returns json::JsonValue ? const

argument

argument type

a

json::JsonValue ? const!

idx

int const

Returns the value of the index in the JSON array, if it exists.

operator ?[](a: JsonValue? ==const; idx: int const)

?[] returns json::JsonValue ?

argument

argument type

a

json::JsonValue ?!

idx

int const

Returns the value of the index in the JSON array, if it exists.

operator ??(a: JsonValue? const; val: double const)

?? returns double

argument

argument type

a

json::JsonValue ? const

val

double const

Returns the value of the JSON object, if it exists, otherwise returns the default value.

operator ??(a: JsonValue? const; val: float const)

?? returns float

argument

argument type

a

json::JsonValue ? const

val

float const

Returns the value of the JSON object, if it exists, otherwise returns the default value.

operator ??(a: JsonValue? const; val: int8 const)

?? returns int8

argument

argument type

a

json::JsonValue ? const

val

int8 const

Returns the value of the JSON object, if it exists, otherwise returns the default value.

operator ??(a: JsonValue? const; val: int16 const)

?? returns int16

argument

argument type

a

json::JsonValue ? const

val

int16 const

Returns the value of the JSON object, if it exists, otherwise returns the default value.

operator ??(a: JsonValue? const; val: int const)

?? returns int

argument

argument type

a

json::JsonValue ? const

val

int const

Returns the value of the JSON object, if it exists, otherwise returns the default value.

operator ??(a: JsonValue? const; val: int64 const)

?? returns int64

argument

argument type

a

json::JsonValue ? const

val

int64 const

Returns the value of the JSON object, if it exists, otherwise returns the default value.

operator ??(a: JsonValue? const; val: uint8 const)

?? returns uint8

argument

argument type

a

json::JsonValue ? const

val

uint8 const

Returns the value of the JSON object, if it exists, otherwise returns the default value.

operator ??(a: JsonValue? const; val: uint16 const)

?? returns uint16

argument

argument type

a

json::JsonValue ? const

val

uint16 const

Returns the value of the JSON object, if it exists, otherwise returns the default value.

operator ??(a: JsonValue? const; val: uint const)

?? returns uint

argument

argument type

a

json::JsonValue ? const

val

uint const

Returns the value of the JSON object, if it exists, otherwise returns the default value.

operator ??(a: JsonValue? const; val: uint64 const)

?? returns uint64

argument

argument type

a

json::JsonValue ? const

val

uint64 const

Returns the value of the JSON object, if it exists, otherwise returns the default value.

operator ??(a: JsonValue? const; val: bool const)

?? returns bool

argument

argument type

a

json::JsonValue ? const

val

bool const

Returns the value of the JSON object, if it exists, otherwise returns the default value.

operator ??(a: JsonValue? const; val: string const)

?? returns string

argument

argument type

a

json::JsonValue ? const

val

string const

Returns the value of the JSON object, if it exists, otherwise returns the default value.

operator ?.`value(a: JsonValue? const ==const)

?.`value returns JsValue ?

argument

argument type

a

json::JsonValue ? const!

Returns the value of the JSON object, if it exists.

operator ?.`value(a: JsonValue? ==const)

?.`value returns JsValue ?

argument

argument type

a

json::JsonValue ?!

Returns the value of the JSON object, if it exists.