Probably a rest bug? for nested item (REST/JSON)

Hi guys,

i’m scraping some data from a website, that goes great with 0 issue’s
however there is a nested item i need to have.

its in:

“account”: {
“id”: “107********8”}

Well when i try to scrape account it scrapes all of that normally, and i can use in developer>templates
this code:

{{ state_attr(“sensor.test1”, “account”).id }}

and it shows the ID

But i want it to be included as a json attribute, so i did try this:

  value_template: "{{ ok}}"
    - "account"
    - ""
    - "account[0].id"
    - "account[id]"

So account scrapes, but the other 3 don’t work at all.

Any idea ?


Those selectors won’t work in json_attributes. What you can do is define json_attributes_path to point to the sub-structure where your JSON contains key-value-pairs.

  - resource: <your URL>
      - name: Account
        value_template: "ok"
        json_attributes_path: "$.account"
          - "id"

Thanks for that, but then i would not be able to retrieve the other ones.
i wanted to do it in one go.

The nested ones and before the nested ones.

Account → ID
Account - > Name