Rest sensor: Stuck parsing the answer in sensor attribute

Hello,
I’m stuck with creating a REST sensor that intercepts the response to a GET rest call. I can’t find how to import all the parameters of the response inside the sensor attributes. Below I report both the answer and my attempt to do the above but without success (or rather with partial success: I can only insert an entry with all parameters).
My final goal is then to represent data in a table card.

[
  {
    "id": "1",
    "product_id": "2",
    "amount": "5",
    "best_before_date": "2022-12-07",
    "purchased_date": "2022-10-28",
    "stock_id": "635ba5e19568f",
    "price": null,
    "open": "0",
    "opened_date": null,
    "row_created_timestamp": "2022-10-28 11:50:25",
    "location_id": "2",
    "shopping_location_id": null,
    "note": ""
  },
  {
    "id": "2",
    "product_id": "1",
    "amount": "10",
    "best_before_date": "2023-03-16",
    "purchased_date": "2022-10-28",
    "stock_id": "635ba611df488",
    "price": "0",
    "open": "0",
    "opened_date": null,
    "row_created_timestamp": "2022-10-28 11:51:13",
    "location_id": "2",
    "shopping_location_id": null,
    "note": ""
  }
]
- platform: rest
  resource: https://myhadomain.duckdns.org:9192/api/stock/locations/2/entries
  method: GET
  name: "Fridge"
  scan_interval: 60
  headers:
    GROCY-API-KEY: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    Content-Type: application/json
  value_template: 'Ok'
  json_attributes_path: "$..*"
  json_attributes:
    - id
    - product_id
    - amount
    - best_before_date
    - purchased_date
    - stock_id
    - price
    - open
    - opened_date
    - row_created_timestamp
    - location_id
    - shopping_location_id
    - note

Thank you very much for every advice you can provide

Try something like this…I put your data in a file test2.json in folder www…

rest:             
  - authentication: basic
    scan_interval: 3000
    verify_ssl: false
    resource: "http://192.168.1.20:8124/local/test2.json"
    sensor:
      - name: testfirst
        value_template: "{{ value_json.0.product_id }}"
        json_attributes_path: $.0
        json_attributes:
          - amount
          - best_before_date
      - name: testsecond
        value_template: "{{ value_json.1.product_id }}"

I am sorry: I omitted to say that the answer is dynamic and the entries can vary. In the example there are two but they can be N.

Can you deal with this clarification and get out for it with a solution?

Thank You anyway

For as far I know, that does not exist (yet)…see other posts where I commented similarly and never received a ‘you are wrong’ from the real experts :slight_smile:
The alternative is to put the whole json in a single attribute and you can then use that dynamically in e.g. graphs or automations or…

Yes! The last thing you wrote is what I am trying to do but i am not able to!
Can you please write how I can put all the json in one single attribute?

Then I will work on display it like you mention.

Thank you very much

Have a look here, via command_line…not very elegant but it works.

Thank you very much: it works!

Great…if possible please mark one of my posts for ‘solution’ so others can see this too (this option is not always available so I learned recently)