Category: Javascript

Q: Javascript extract rows with conditions from a JSON

I have a json that generated from a cakephp api, like:

[
  {
    "_id": "57fcaf7173e3f772d54e991f",
    "isActive": true,
    "balance": "2,095.68",
    "name": "**",
    "email": "**"
  },
  {
    "_id": "57fcaf71862f790be6b77779",
    "isActive": true,
    "balance": "1,740.58",
    "name": "**",
    "email": "**"
  },
  {
    "_id": "57fcaf710b2de8d441493d7e",
    "isActive": true,
    "balance": "1,089.43",
    "name": "**",
    "email": "**"
  },
  {
    "_id": "57fcaf71c61614eef67cf695",
    "isActive": true,
    "balance": "2,593.69",
    "name": "**",
    "email": "**"
  },
  {
    "_id": "57fcaf717bd76378041dbfc6",
    "isActive": false,
    "balance": "1,035.51",
    "name": "**",
    "email": "**"
  },
  {
    "_id": "57fcaf719b950431be9548a4",
    "isActive": true,
    "balance": "2,223.25",
    "name": "**",
    "email": "**"
  }
]

And I want to extract data rows with conditions "isActive:true" and "balance > 1000" from this json, and I do not like to call another api to do this. Is there a "javascript" way to extract users? many thanks to you guys.

json extract
0 Answers

No answers yet!

The community needs your help!

Post your Answer