Skip to content

JSON

JSON

href for json

This feature allows to control presence of URL references in the output. Query string href overrides INI settings json_sdb.href.

Usage:
URL

?href=[true_or_false]

INI settings

json_sdb.href = [true_or_false]

Value type: boolean (True or False)

Default: True

Applicable to: list of resources, list of arrays, vectors, single resource, single array, scalar

Examples:
/Chinook/Artist/ArtistId/1.json?href=false - URL references don't appear in output.

{
"ArtistId": 1,
"Name": "AC/DC"
}

/Chinook/Artist/ArtistId/1.json?href=true - URL references appear in output.

{
"Album": {
"__href": "/db/Chinook/Artist/ArtistId/1/Album.json"
},
"ArtistId": 1,
"Name": "AC/DC",
"__href": "/db/Chinook/Artist/ArtistId/1.json"
}

scalarObject

Allows to change the default behaviour in handling scalar values in JSON requests. When True then scalar is wrapped in JSON object structure with name of the column

{
  "Name": "AC/DC"
}

When False then only the value is returned.

"AC/DC"

Usage:

?scalarObject=[true_or_false]

Value type: boolean (True or False)

Default: True

Applicable to: single array, scalar

/Customer/CustomerId/18/Country.json?scalarObject - scalarObject applied on a scalar /Customer/Country.json?scalarObject - scalarObject applied on a single array


NaN & Infinity Encoding for json

This parameter controls how nan, inf, and -inf values in floating point columns will be handled in JSON requests for databases that support the IEEE 754-1985 specification. This query string will override the json_sdb.nan_inf_encoding INI parameter. See the JSON INI documentation for more information.

Usage:
URL

?jsonNanInf=[`null`, `number`]

Value type: string

Value options:

  • null - output nan, inf, and -inf floating point values as Javascript null

  • number - output nan, inf, and -inf floating point values as Javascript NaN, Infinity, or -Infinity; accept NaN, Infinity, and -Infinity as valid values for floating point columns in POST or PUT requests with JSON payloads.

Default: null

Applicable to: list of resources, list of arrays, vectors, single resource, single array, scalar

Examples: See the JSON INI documentation