Users of Looker’s beta API can receive output as JSON. As of Looker 3.52 users can choose to have JSON numbers returned to them as numbers, instead of quoted strings.
This will impact all API function calls where:
- You specify
json
as theresult_format
parameter (such as in therun_query()
function) - You do NOT specify
apply_formatting=true
on the call
This change is associated with the JSON Numbers as Strings legacy feature (for more details see the Legacy Features docs page). By default, this feature is checked, which means that no change in behavior will occur. If you want the new behavior, un-check this legacy feature and click the Update Legacy Features button.
This change should make JSON results easier to work with. However, users who had been casting strings into numbers during their JSON parsing, or who did want to consume numbers as strings, may need modify their code.
Old Output Example
In the old behavior, all JSON values are returned as quoted strings:
[
{
"title.kind": "Movie",
"title.count": "846055",
"title.run_time": "1.45"
}
]
New Output Example
With the new behavior, numbers are no longer quoted:
[
{
"title.kind": "Movie",
"title.count": 846055,
"title.run_time": 1.45
}
]