so my table looks like this
{"@timestamp":"2018-08-08T09:21:57.947+00:00","@version":"1","message":"bla bla"}
i can extract for example the message part using the json functions like below
JSON_EXTRACT_SCALAR(log,'$.message') AS message
but when i try to extract the timestamp the same way
JSON_EXTRACT_SCALAR(log,'$.@timestamp') AS timestamp
i get the error "Error: Unsupported operator in JSONPath: @" any ideas on the correct syntax?
In cases where a JSON key uses invalid JSONPath characters, you can escape those characters using single quotes and brackets, [' ']. For example:
$['@timestamp']
SELECT
json_extract_scalar('{"@timestamp":"2018-08-08T09:21:57.947+00:00"}',"$['@timestamp']")
See more examples on: JSON Functions in Standard SQL
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With