I have an API that returns the data as an object in this format attached below, I'm trying to write a function that wou

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

I have an API that returns the data as an object in this format attached below, I'm trying to write a function that wou

Post by answerhappygod »

I have an API that returns the data as an object in this formatattached below, I'm trying to write a function thatwould take the object as an input, then output the occurrence ofeach status value in an object array: i.e. [ERROR: 2,WARNING: 3, OK: 2]. The problem is that I don't knowhow to access and count the values when 'status' is nested underdifferent layers.
```
```
This is the function I'm trying to modify to achieve what Iwant, it only works when 'obj' is a parent of an object with the'status' key
```
}
```
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply