Quantcast
Channel: Question and Answer » json
Viewing all articles
Browse latest Browse all 148

Summing values from JSON end point based on category [closed]

$
0
0

I have a JSON end point for projects in a county. I am able to call a list of any of the object properties. What I want to do is to add together either all the values of budget property or the spent_encumbered by the value of category property.

For example, the total cost of all the projects that were for bridges, general county projects, school systems projects, etc.

Ideas I’ve had:

  • Return all the values of the category property
  • Push them all to an array
  • Do an if statement, if data[i].category === "school system projects" // or whatever array value?
  • For loop to add up all the returned budget values for the specific category.

Thoughts?


Viewing all articles
Browse latest Browse all 148

Latest Images

Trending Articles



Latest Images