Question

Deprecation Notice: JSON Numbers Can be Returned as Numbers Instead of Strings in API (3.52+)

  • 28 July 2016
  • 0 replies
  • 43 views

Userlevel 3

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:



  1. You specify json as the result_format parameter (such as in the run_query() function)

  2. 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
}
]

0 replies

Be the first to reply!

Reply