You have a sudden craving for pancakes. As a modern technically-inclined person, you write a shopping list for pancake ingredients in JSON format. The structure of the list is:
{
"name": "name of shopping list",
"ingredients": [ ...list of ingredients... ],
"optional ingredients": [ ...list of ingredients... ]
}An ingredient is represented as a JSON object, like:
{
"item": "flour",
"amount": {
"quantity": 2,
"unit": "cup"
}
}An ingredient has an optional property named "substitute" that holds a
string of another item that can be used instead.
Let's see how we can examine the shopping list with jq
Write an expression that outputs the "name" element of the shopping list.
Only count the "required" ingredients. Don't include the optional ingredients.
Write an expression that outputs the amount of sugar. Just the numeric part is wanted.
Some of the ingredients can be substituted (if you don't have ingredient X you can use Y). Output a JSON object mapping the recommended ingredient to its substitution. Include the optional ingredients in the mapping.
You have a sudden craving for pancakes. As a modern technically-inclined person, you write a shopping list for pancake ingredients in JSON format. The structure of the list is:
{
"name": "name of shopping list",
"ingredients": [ ...list of ingredients... ],
"optional ingredients": [ ...list of ingredients... ]
}An ingredient is represented as a JSON object, like:
{
"item": "flour",
"amount": {
"quantity": 2,
"unit": "cup"
}
}An ingredient has an optional property named "substitute" that holds a
string of another item that can be used instead.
Let's see how we can examine the shopping list with jq
Write an expression that outputs the "name" element of the shopping list.
Only count the "required" ingredients. Don't include the optional ingredients.
Write an expression that outputs the amount of sugar. Just the numeric part is wanted.
Some of the ingredients can be substituted (if you don't have ingredient X you can use Y). Output a JSON object mapping the recommended ingredient to its substitution. Include the optional ingredients in the mapping.