La documentación para desarrolladores está en inglés.
Tipo de tarjeta
nutrition.facts
Energy and nutrients for a food and serving, with alternative servings.
Version 1 · schema nutrition.facts.v1.schema.json
Layouts
Every card type has full. Pick a layout with the element's layout attribute, render.layout, or a theme.
Fields
The fields of card.data. Values a source doesn't provide are null; new optional fields can appear within version 1.
| Field | Type | Required | Notes |
|---|---|---|---|
food | object | yes | |
food.name | string | yes | |
food.description | string | null | ||
serving | object | yes | |
serving.label | string | yes | |
serving.grams | number | yes | |
serving.alternatives[] | object[] | yes | |
serving.alternatives[].label | string | yes | |
serving.alternatives[].grams | number | yes | |
energy_kcal | number | yes | |
energy_split_pct | object | yes | Share of energy from each macronutrient; sums to 100. |
energy_split_pct.carbohydrates | number | yes | |
energy_split_pct.protein | number | yes | |
energy_split_pct.fat | number | yes | |
nutrients[] | object[] | yes | |
nutrients[].key | string | yes | |
nutrients[].label | string | yes | In the answer locale. |
nutrients[].amount | number | yes | |
nutrients[].unit | enum | yes | g · mg · µg |
nutrients[].daily_value_pct | number | null | yes | Of the US FDA daily value; null when there is none. |
Example
A recorded answer to “How many calories are in a banana?”. Open it in the Answer Lab to see every layout and style.
{
"v": 2,
"id": "ans_ebc39049696a",
"matched": true,
"locale": "en",
"skill": "nutrition",
"confidence": 0.96,
"text": "A medium banana (118 g) has about 105 kcal, mostly from carbohydrates: 27 g, including 14 g of sugars. It also gives you 3.1 g of fiber and 422 mg of potassium.",
"speech": "A medium banana has about 105 calories.",
"card": {
"type": "nutrition.facts",
"version": 1,
"data": {
"food": {
"name": "Banana",
"description": "raw"
},
"serving": {
"label": "1 medium",
"grams": 118,
"alternatives": [
{
"label": "1 small",
"grams": 101
},
{
"label": "1 large",
"grams": 136
}
]
},
"energy_kcal": 105,
"energy_split_pct": {
"carbohydrates": 93,
"protein": 4,
"fat": 3
},
"nutrients": [
{
"key": "carbohydrates",
"label": "Carbohydrates",
"amount": 27,
"unit": "g",
"daily_value_pct": 10
},
{
"key": "fiber",
"label": "Fiber",
"amount": 3.1,
"unit": "g",
"daily_value_pct": 11
},
{
"key": "sugars",
"label": "Sugars",
"amount": 14.4,
"unit": "g",
"daily_value_pct": null
},
{
"key": "protein",
"label": "Protein",
"amount": 1.3,
"unit": "g",
"daily_value_pct": 3
},
{
"key": "fat",
"label": "Fat",
"amount": 0.39,
"unit": "g",
"daily_value_pct": 0
},
{
"key": "potassium",
"label": "Potassium",
"amount": 422,
"unit": "mg",
"daily_value_pct": 9
},
{
"key": "vitamin_b6",
"label": "Vitamin B6",
"amount": 0.43,
"unit": "mg",
"daily_value_pct": 25
},
{
"key": "vitamin_c",
"label": "Vitamin C",
"amount": 10.3,
"unit": "mg",
"daily_value_pct": 11
}
]
}
},
"sources": [
{
"name": "USDA FoodData Central",
"url": "https://fdc.nal.usda.gov",
"license": "Public domain"
}
],
"follow_ups": [
"And a large one?",
"How much protein is in 100 g of cooked lentils?"
],
"actions": [],
"usage": {
"billable": true
}
}