Skip to content

Format Specific Output

Some URL query string parameters (modifiers) are only valid for certain formats. Below is a detailed description of each format-specific parameter.

JSON-specific

href

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

Changes the default behaviour in handling scalar values in JSON requests. When true, the scalar is wrapped in a JSON object structure with name of the column.

{
  "Name": "AC/DC"
}

When false, only the value is returned.

"AC/DC"

Important

When set to true, a PUT request to a scalar endpoint needs to have a JSON object with the scalar in the payload. When false, the payload should be a value only.

Scalars in JSON format are wrapped in objects by default. See the JSON INI settings for more information.

Usage:

?scalarObject=[true_or_false]

Value type: boolean (true or false) Default: false

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


jsonNanInf

This parameter controls how the special JSON values nan, inf, and -inf 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.

Info

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


XML-specific

nil_visible

This modifier includes empty tags in XML responses.

Usage:

?nil_visible=[true_or_false]

Value type: boolean (true or false)

Default: false

Examples:

/query/customers-in-city/city/Paris.xml - empty tags not included by default

/query/customers-in-city/city/Paris.xml?nil_visible=false - empty tags not included

/query/customers-in-city/city/Paris.xml?nil_visible=true - empty tags included


href

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

Usage:
URL

?href=[true_or_false]

INI settings

xml_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.xml?href=false - URL references don't appear in output.

<?xml version="1.0" encoding="utf-8"?>
<SlashDB xmlns="http://www.vtenterprise.com/slashdb" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xsi:schemaLocation="http://www.vtenterprise.com/slashdb https://demo.slashdb.com/db/Chinook/Artist.xsd?cardinality=1">
    <Artist>
        <ArtistId>1</ArtistId>
        <Name>AC/DC</Name>
    </Artist>
</SlashDB>

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

<?xml version="1.0" encoding="utf-8"?>
<SlashDB xmlns="http://www.vtenterprise.com/slashdb" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xsi:schemaLocation="http://www.vtenterprise.com/slashdb https://demo.slashdb.com/db/Chinook/Artist.xsd?cardinality=1">
    <Artist href="/db/Chinook/Artist/ArtistId/1.xml">
        <ArtistId>1</ArtistId>
        <Album href="/db/Chinook/Artist/ArtistId/1/Album.xml" />
        <Name>AC/DC</Name>
    </Artist>
</SlashDB>

CSV-specific

headers

Determines if CSV documents should contain column names as headers.

Usage:

?headers=[true_or_false]

Value type: boolean (true or false)

Default: true

Applicable to:

  • list of resources, array, vector, single object
  • PUT request with CSV document containing a list of resources, array, vector, single object
  • POST request with CSV document containing a list of resources, single object

Examples:
/Chinook/Customer.csv - default (with headers)
/Chinook/Customer.csv?headers=true - with headers
/Chinook/Customer.csv?headers=false - without headers


csvNullStr

Sets a string that will be treated as a NULL value by the database when uploading CSV documents (only for PUT and POST requests).

CSV documents do not have a specific representation for NULL values. The csvNullStr lets you define a string to represent them.

This modifier is only useful only for nullable columns and does not affect the way the database driver handles NULL values.

Value type: string

Default: [empty string]

Applicable to:

  • PUT request with CSV document containing a list of resources, array, vector, single object
  • POST request with CSV document containing a list of resources, single object

Usage:

?csvNullStr=[string_representing_null_in_csv]

Examples:

Making a POST request to https://demo.slashdb.com/db/Chinook/Invoice.csv?csvNullStr=myNull with CSV document:

InvoiceId,CustomerId,InvoiceDate,BillingAddress,BillingCity,BillingState,BillingCountry,BillingPostalCode,Total
1000,2,2666-01-01 00:00:00,myNull,Test City,Test State,Test Country,00 000,6.66

will pass the database a NULL value for the BillingAddress column.


TXT-specific

nil_visible

This feature forces NULL values to show as empty lines. Forcing empty lines might be useful when combining data with other requests to keep data in order. By default empty values are not shown to reduce document length.

Usage:

?nil_visible=[true_or_false]

Value type: boolean (true or false)

Default: false

Applicable to: vector

Examples:

/Customer/Company.txt - not showing empty values by default

/Customer/Company.txt?nil_visible=false - not showing empty values

/Customer/Company.txt?nil_visible=true - showing empty values as empty lines