JSON String Only
When returning JSON formats (json
, json.array
, json.rest
) Jarvis will attempt to use native JSON types for appropriate columns. This is a new feature implemented in Jarvis version 7.4.0
and later.
Specifically:
- Numeric columns will be returned as JSON number, not string.
- Boolean columns will be returned as
true
/false
not integer or string. - JSON columns in PostgreSQL will be decoded and returned as sub-objects.
The numeric value behaviour is typically performed by the driver, and cannot generally be disabled.
However, the Boolean and JSON processing is explicit post-processing performed automatically by Jarvis.
- Detection of Boolean/JSON works for PostgreSQL using DBD::Pg version 3.x and later.
- Detection of JSON columns does not work for PostgreSQL using DBD::Pg version 2.x drivers (i.e. when using RHEL 7).
- Detection does not work for SQLite.
- Detection may work for other databases, depending on underlying DBD driver support.
To disable post-processing non-string return for Boolean and JSON column types, set the json_string_only
option to request that these types be returned as strings. This may be required for backwards compatibility for old applications.