json.parse() function
The json.parse()
function is experimental and subject to change at any time.
By using this function, you accept the risks of experimental functions.
The json.parse()
function takes JSON data as bytes and returns a value.
The function can return lists, records, strings, booleans, and float values.
All numeric values are returned as floats.
Function type: Type conversion
import "experimental/json"
json.parse(
data: bytes(v: "{\"a\":1,\"b\":2,\"c\":3}")
)
Parameters
data
JSON data to parse.
Data type: Bytes
Examples
Parse and use JSON data to restructure a table
import "experimental/json"
data
|> map(fn: (r) => {
jsonData = json.parse(data: bytes(v: r._value))
return {
_time: r._time,
_field: r._field,
a: jsonData.a,
b: jsonData.b,
c: jsonData.c,
}
})
Support and feedback
Thank you for being part of our community! We welcome and encourage your feedback and bug reports for InfluxDB and this documentation. To find support, the following resources are available:
InfluxDB Cloud and InfluxDB Enterprise customers can contact InfluxData Support.