Looking for ways to extract total calorie and nutrition information from a large document displaying the nutritional data of a simulated recipe.
Please review the codesandbox json file first.
The objective is to capture the total calories and nutritive content of this object;
The recipe includes an array of ingredients, with each ingredient containing two items;
Each item consists of various facts (such as vitamins, nutrition, calories, among others);
Every fact has a corresponding value attached to it;
Despite trying multiple nested array.map functions, only able to retrieve calorie values for each item separately due to the nested map function returning each calorie in individual arrays...
The goal is to store the values of each item (recipe stuff item) in separate arrays like:
const vitaminValues = []
const nutritionValues = []
const caloriesValues = []
const othersValues = []
If successful in achieving this structure, total calories, vitamins, nutrients, and other details can be obtained
Any alternative methods or suggestions are welcome :) Thank you!
Here is the JSON file for a sample recipe: https://codesandbox.io/s/relaxed-brown-zrxnr?fontsize=14&hidenavigation=1&theme=dark