I am trying to reach a nested json to add as an attribute to my rest sensor for my mealie mealplan.
I have added an extra API key called “message” but it is placed under a key called “extras”. Below is the full json for my dummy meal
{
"id": "8e6d2195-abc1-4b65-bd2a-74ab25bf6297",
"userId": "c8995dd2-b378-4cfa-bf04-32c157bed7ed",
"groupId": "7a44e651-2f9e-4d51-ad11-88b32bae04bc",
"name": "Burger med Oksekød",
"slug": "burger-med-oksekod",
"image": null,
"recipeYield": null,
"totalTime": null,
"prepTime": null,
"cookTime": null,
"performTime": null,
"description": "",
"recipeCategory": [],
"tags": [],
"tools": [],
"rating": null,
"orgURL": null,
"dateAdded": "2025-01-08",
"dateUpdated": "2025-01-08T11:33:42.066923Z",
"createdAt": "2025-01-08T10:20:15.742494Z",
"updateAt": "2025-01-08T10:20:15.742495Z",
"lastMade": null,
"recipeIngredient": [],
"recipeInstructions": [
{
"id": "b63e4d95-2529-43a2-a7a4-fc6c9c6cb3c6",
"title": "",
"text": "Du kan bruge markdown kode i beskrivelser og andre felter i opskrifter.\n\n**Tilføj et link**\n\n[Mit link](https://demo.mealie.io)\n",
"ingredientReferences": []
}
],
"nutrition": {
"calories": null,
"fatContent": null,
"proteinContent": null,
"carbohydrateContent": null,
"fiberContent": null,
"sodiumContent": null,
"sugarContent": null
},
"settings": {
"public": true,
"showNutrition": false,
"showAssets": true,
"landscapeView": false,
"disableComments": false,
"disableAmount": true,
"locked": false
},
"assets": [],
"notes": [],
"extras": {
"message": "Husk at tage kød op af fryseren"
},
"comments": []
}
My sensor is created like this:
- platform: rest
name: mealie_mealplan_day1
resource: myIP/api/groups/mealplans
scan_interval: 3600
headers:
Authorization: Bearer myToken
params:
start_date: >
{{ (now() + timedelta(days = 1)).strftime('%Y-%m-%d') }}
end_date: >
{{ (now() + timedelta(days = 1)).strftime('%Y-%m-%d') }}
json_attributes_path: "$.[0].recipe"
json_attributes:
- id
- name
- slug
- image
- dateAdded
value_template: "{{ value_json.date }}"
I can add stuff like dateAdded without any problems, but how do I reach the “message” under “extras” ?