Need some help on decoding stacked payload

Dear all,
need some help on decoding a stacked payload.
The payload lokks like this:
“object”: {
“temperatureSensor”: {
“1”: 4.16,

i was able to decode like this:
“object”: {
“temperatureSensor”: 4.16,
with yaml:

  • platform: mqtt
    state_topic: “xxx”
    name: “yyyy”
    unit_of_measurement: “°C”
    value_template: “{{ value_json.object.temperatureSensor}}”
    but the stacked version makes some problems
    tried:
    a) value_template: “{{ value_json.object.1}}”
    b) value_template: “{{ value_json.object.[1]}}”
    a) value_template: “{{ value_json.object.(1)}}”
    nothing works

what to use

any ideas?
SatDad

Please format your json and yaml properly. See point 11 here. It also looks like both of your json examples are incomplete. It is generally a good idea to provide a minimal working example (or even the whole thing), not just the first few lines.

I think you either need something like this:

{{ value_json.object.temperatureSensor["1"] }}

Sorry about the bad formatting, will do my very best in the future.
Not the

{{ value_json.object.temperatureSensor["1"] }}

but a single " ’ "

{{ value_json.object.temperatureSensor['1'] }}

did the trick, thank you for the hint!

That’s probably because you surrounded the whole template in double quotes.
Either

'{{ value_json.object.temperatureSensor["1"] }}'

or

"{{ value_json.object.temperatureSensor['1'] }}"

should work.