-3

My object is as below

    "permission": {
      "delete": {
        "253": false,
        "255": true
      }
    }

How would I filter to find if 255 is true

Cédric M.
  • 1,142
  • 3
  • 12
  • 23
user2837961
  • 1,505
  • 3
  • 27
  • 67
  • When you say filter, what exactly do you mean? Are you just trying to access that property? If so, couldn't you just use something like `parent.permission.delete["255"]`? (Assuming you parse your JSON as a JS object) – DBS May 15 '19 at 12:34
  • Possible duplicate of [JavaScript: filter() for Objects](https://stackoverflow.com/questions/5072136/javascript-filter-for-objects) – Evan Bechtol May 15 '19 at 12:35
  • the word "filter" is typically used when referring to selecting a subset of items from a set whose attributes match a set of criteria. are you asking to find all properties (subset) of the "delete" object properties (set) that match the criteria of "having the boolean value 'true'"? – Andrew Castellano May 15 '19 at 14:16

1 Answers1

1

const test = {
  "permission": {
      "delete": {
        "253": false,
        "255": true
      }
    }
}

const hasDelete255 = test.permission.delete["255"];
console.log(hasDelete255)
Cédric M.
  • 1,142
  • 3
  • 12
  • 23
Bill Souvas
  • 46
  • 2
  • 6