简体   繁体   中英

Google DataStudio REGEX_EXTRACT json

I am trying to create a new field by creating a calculated field and parsing some json in Google DataStudio. However I keep getting an error saying Failed to fetch data from the underlying data set if I use REGEX_EXTRACT

formula I am using:

REGEXP_EXTRACT(json,'(?<="received_at":")(.*?)(?=")')

json string:

{"end_device_ids":{"device_id":"eui-a81758fffe0600cc","application_ids":{"application_id":"3cc54cfd-a809-42e3-89bb-4497ec67fe42"},"dev_eui":"A81758FFFE0600CC","join_eui":"0000000000000000","dev_addr":"260B1B1E"},"correlation_ids":["as:up:01FG833XJCCNBGDDNDYDRV9SRR","gs:conn:01FG16JYQBRKZC3K8HXE6CWK89","gs:up:host:01FG16JZSSC6GWA8TNY733T5GK","gs:uplink:01FG833XBKQGR83P9MTXSEQQHE","ns:uplink:01FG833XBR0NHHAM079T00ZC76","rpc:/ttn.lorawan.v3.GsNs/HandleUplink:01FG833XBR8SJYB9BMX8ZC61YY","rpc:/ttn.lorawan.v3.NsAs/HandleUplink:01FG833XJBN6BQX9HP4MYK51YR"],"received_at":"2021-09-23T01:08:02.252783252Z","uplink_message":{"session_key_id":"AXvkNZkkbAdO+pD5hVSLXg==","f_port":5,"f_cnt":1230,"frm_payload":"AQDoAjwHDjY=","decoded_payload":{"humidity":60,"temperature":23.2,"vdd":3638},"rx_metadata":[{"gateway_ids":{"gateway_id":"iot-stadslab-1","eui":"A84041FFFF1F9951"},"time":"2021-09-23T01:08:06.175212Z","timestamp":2063422380,"rssi":-125,"channel_rssi":-125,"snr":-8.2,"location":{"latitude":51.69522207692182,"longitude":5.293667793175701,"altitude":15,"source":"SOURCE_REGISTRY"},"uplink_token":"ChwKGgoOaW90LXN0YWRzbGFiLTESCKhAQf//H5lREKyn9dcHGgsI8qavigYQroDmECDgr7vshpo1","channel_index":4}],"settings":{"data_rate":{"lora":{"bandwidth":125000,"spreading_factor":10}},"data_rate_index":2,"coding_rate":"4/5","frequency":"867300000","timestamp":2063422380,"time":"2021-09-23T01:08:06.175212Z"},"received_at":"2021-09-23T01:08:02.040299926Z","consumed_airtime":"0.370688s","network_ids":{"net_id":"000013","tenant_id":"ttn","cluster_id":"ttn-eu1"}}}

My regular expression is working as expected inside Regex101. Why is my formula not working? If I try to manually add a column in google sheets using the REGEXEXTRACT(A2, "(?<=\"received_at\":\").*?(?=\")") function I am also getting an error that tells me nothing. Any solution to my problem is appreciated.

Thank you in advance.

Your regex is

=regexextract(A2,"""received_at"":"".*?""")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM