Json Parsing keys with space caracter

Hi,

I a have an issue with the parsing of json because of a space in the key name or a -
How can I extract datas of the key name with spaces or - ?
Is it possible ?

Thank you in advance

{
    "product": "IPX800_V4",
    "status": "Success",
    "R1": 0,
    "R2": 0,
    "R3": 0,
    "R4": 0,
    "R5": 0,
    "R6": 0,
    "R7": 0,
    "R8": 0,
    "THL1-TEMP": 9.98,
    "ENO SWITCH1": 0,
}

Use bracket notation instead of dot notation.

This:

{{ value_json['ENO SWITCH1'] }}

Here’s an example from the documentation for State Object:

When an attribute contains spaces, you can retrieve it like this: states.sensor.livingroom.attributes["Battery numeric"] .

Oh yes It works :slight_smile:

Thanks a lot

1 Like

Glad to hear it solved your problem. Please mark my previous post with the Solution tag. Only you, the author of this topic, can do that. It will automatically place a check-mark next to the topic’s title and signal to others that this topic has an accepted solution.

Sure no problem :ok_hand: