How to read JSON data from Webhook with Brackets?

I have a router that is exposing some statistical data via Webhook.
The JSON output looks like this:

 "Status": {
    "Uptime": "100138",
    "Memory": "86",
    "CPU": "3",
    "WAN1_status": "UP",
    "WAN1_IP": "redacted",
    "WAN1_tx(Bytes)": "312790",
    "WAN1_tx_packets(Counts)": "890494",
    "WAN1_tx_rate(bps)": "363112",
    "WAN1_rx(Bytes)": "671908",
    "WAN1_rx_packets(Counts)": "1383601",
    "WAN1_rx_rate(bps)": "7424768",
    "WAN1_sessions(Sessions)": "45",
    "WAN2_status": "UP",
    "WAN2_IP": "redacted",
     .......

While I can read WAN1_status without any problem via

{{trigger.json.Status.WAN1_status}}

I could not find any way to read any of the Values containing Brackets in the name, such as WAN1_tx_rate(bps).
Any attempt via

{{trigger.json.Status.WAN1_tx_rate(bps)}}

comes back empty.
I suspect I need to somehow esacpe the “(” and “)” characters but all attempts based on internet research failed so far.
Does anyone know how to escape these brackets?

My only other option would be to parse the entire “Status” block and text-split my way through it, but I would like to avoid that if I can.

Thanks!

Use bracket notation instead of dot notation.

{{ trigger.json.Status['WAN1_tx_rate(bps)'] }}
1 Like

Ok now I am officialy confused… I stumbled accross the Square Bracket notation as I also use it in other places… so it was one of the first things I tried.
And it did not work… welll now it works :flushed:… so seems I blundered there somewhere… Should probably not try to build new Stuff in my HA after long working days :grimacing:

Thanks a million @123 for setting me back on the right track!

1 Like

I think I figured where my problem was…

I tried {{ trigger.json.Status.['WAN1_tx_rate(bps)'] }}

The dot after “Status” was the problem.

1 Like

Maybe you had overlooked to wrap WAN1_tx_rate(bps) in quotes? For example, this will not work.

{{ trigger.json.Status[WAN1_tx_rate(bps)] }}

EDIT

My reply was too late … the period before the opening bracket in your example is what had caused the error.