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

Creates JsonValue out of value.

JV(v: int const)

JV returns json::JsonValue ?

argument

argument type

v

int const

Creates JsonValue out of value.

JV(v: bitfield const)

JV returns json::JsonValue ?

argument

argument type

v

bitfield<> const

Creates JsonValue out of value.

JV(val: int8 const)

JV returns json::JsonValue ?

argument

argument type

val

int8 const

Creates JsonValue out of value.

JV(val: uint8 const)

JV returns json::JsonValue ?

argument

argument type

val

uint8 const

Creates JsonValue out of value.

JV(val: int16 const)

JV returns json::JsonValue ?

argument

argument type

val

int16 const

Creates JsonValue out of value.

JV(val: uint16 const)

JV returns json::JsonValue ?

argument

argument type

val

uint16 const

Creates JsonValue out of value.

JV(val: uint const)

JV returns json::JsonValue ?

argument

argument type

val

uint const

Creates JsonValue out of value.

JV(val: int64 const)

JV returns json::JsonValue ?

argument

argument type

val

int64 const

Creates JsonValue out of value.

JV(val: uint64 const)

JV returns json::JsonValue ?

argument

argument type

val

uint64 const

Creates JsonValue out of value.

from_JV(v: json::JsonValue explicit? 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: json::JsonValue explicit?; 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: json::JsonValue explicit?; 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: json::JsonValue explicit?; 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: json::JsonValue explicit?; 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: json::JsonValue explicit?; 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: json::JsonValue explicit?; 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: json::JsonValue explicit?; 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: json::JsonValue explicit?; 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: json::JsonValue explicit?; 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: json::JsonValue explicit?; 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: json::JsonValue explicit?; 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: json::JsonValue explicit?; 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: json::JsonValue explicit?; 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

Creates JsonValue out of value.

from_JV(v: json::JsonValue explicit?; 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: json::JsonValue explicit?; 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: json::JsonValue explicit?; 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

Creates JsonValue out of value.

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

JV returns json::JsonValue ?

argument

argument type

val1

auto const

val2

auto const

Creates JsonValue out of value.

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

Creates JsonValue out of value.

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

Creates JsonValue out of value.

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

Creates JsonValue out of value.

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

Creates JsonValue out of value.

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

Creates JsonValue out of value.

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

Creates JsonValue out of value.

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

Creates JsonValue out of value.

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

Creates JsonValue out of value.