Json_attributes_path confusion, how do I get these values as attributes?

The sensor I created looks like this:

- platform: rest
  name: Replace AC Filter
  resource:  http://homeassistant.local:9192/api/chores/2
  method: GET
  value_template: '{{ (((as_timestamp(value_json.next_estimated_execution_time))-as_timestamp(value_json.last_tracked))| int /60/1440) | round(0) }}'
  json_attributes:
    - last_tracked
    - next_estimated_execution_time
  headers:
    Accept: application/json
    Content-Type: application/json
    GROCY-API-KEY: !secret grocy_api
  unit_of_measurement: 'Days'

The resulting sensor shows up with the correct information. The state is calculated correctly, and the attributes are:

last_tracked: 2025-03-01 02:35:30
next_estimated_execution_time: 2025-04-01 00:00:00
unit_of_measurement: Days
friendly_name: Replace AC Filter

The JSON resulting from the API GET looks like this:

{
    "chore": {
        "id": 2,
        "name": "Replace A/C Filter",
        "description": null,
        "period_type": "monthly",
        "period_days": 1,
        "row_created_timestamp": "2025-03-06 19:37:32",
        "period_config": null,
        "track_date_only": 0,
        "rollover": 0,
        "assignment_type": "in-alphabetical-order",
        "assignment_config": "2",
        "next_execution_assigned_to_user_id": 2,
        "consume_product_on_execution": 0,
        "product_id": null,
        "product_amount": null,
        "period_interval": 1,
        "active": 1,
        "start_date": "2025-03-01 02:35:30",
        "rescheduled_date": null,
        "rescheduled_next_execution_assigned_to_user_id": null
    },
    "last_tracked": "2025-03-01 02:35:30",
    "tracked_count": 1,
    "last_done_by": {
        "id": 2,
        "username": "jgriffith",
        "first_name": "Jon",
        "last_name": "Griffith",
        "row_created_timestamp": "2025-03-03 20:36:51",
        "display_name": "Jon Griffith",
        "picture_file_name": null
    },
    "next_estimated_execution_time": "2025-04-01 00:00:00",
    "next_execution_assigned_user": {
        "id": 2,
        "username": "jgriffith",
        "first_name": "Jon",
        "last_name": "Griffith",
        "row_created_timestamp": "2025-03-03 20:36:51",
        "display_name": "Jon Griffith",
        "picture_file_name": null
    },
    "average_execution_frequency_hours": null
}

When added in the json_attributes section of the rest sensor, the top level items that don’t have a sub-section become the attributes.

In addition to the last_tracked, I’d like to also have items under chore show up as attributes.

When I use a JSON path evaluator, I can access these elements by using $.last_tracked and $.chore.period_type.

If I attempt to use json_attributes_path in the rest sensor, the attributes disappear from the sensor.

I believe I have the syntax wrong, or I’m not entering something correctly.

Question:

How do I include top level and sub-level data as attributes simultaneously?

Not in one sensor, it only allows one path, you can use the RESTful integration so you can have one resource and multiple sensors.
Other options:

  • use command line with curl and jq to reformat the json so that it only kicks back those keys that you want
  • use a command line with curl to load the whole json as attributes and then you could posisbly work with that in card a.o.