How to set True and False based particular key in object Array?


I am calling one API and getting the response (Below is the response) I am getting JOHN_FARY from the session and I want to check only JOHN_FARY key values, Even View is false for all _id then it should return a false value.

Suppose, If I will get JACKY_MANY then check should be same.

[ { "_id": "app-first", "project": "Backend", "accessForPortal": "userPortal", "visible": true, "JOHN_FARY": { "View": true, "Down": true, "Up": true, "Left": true }, "JACKY_MANY": { "View": true, "Down": true, "Up": true, "Left": true }, "JACK_MAN": { "View": true, "Down": true, "Up": true, "Left": true }, "GROUND_POL": { "View": true, "Down": true, "Up": true, "Left": true }, "_etag": { "$oid": "5b7c07364b402e87085d9d7f" } }, { "_id": "app-rule-second", "project": "Backend", "accessForPortal": "userPortal", "JOHN_FARY": { "View": true, "Enable": true, "Edit": true, "Delete": true }, "JACKY_MANY": { "View": true, "Enable": true, "Edit": true, "Delete": true }, "JACK_MAN": { "View": true, "Enable": true, "Edit": true, "Delete": true }, "GROUND_POL": { "View": true, "Enable": true, "Edit": true, "Delete": true }, "_etag": { "$oid": "5b7c07364b402e87085d9d7f" } }, { "_id": "app-thirs-rules", "project": "Backend", "visible": true, "accessForPortal": "userPortal", "JOHN_FARY": { "View": true, "Enable": true, "Edit": true, "Delete": true }, "JACKY_MANY": { "View": true, "Enable": true, "Edit": true, "Delete": true }, "JACK_MAN": { "View": true, "Enable": true, "Edit": true, "Delete": true }, "GROUND_POL": { "View": true, "Enable": true, "Edit": true, "Delete": true }, "_etag": { "$oid": "5b7c07364b402e87085d9d7f" } } ]


There are many ways, but this one should be simplest.

function getView(name){ return response.some(e=>e[name].View === true) } getView('JOHN_FARY') // true


  • Entity Framework Adding Existing Item Causes Clone
  • Python Threads (or their equivalent) on Google Application Engine Workaround?
  • Installing chisel
  • mysql user row level access
  • CORS issue with Vue.js
  • How to visualize output of intermediate layers of convolutional neural network in keras?
  • How to setup django 1.8 to use jinja2?
  • Write JSON data from front-end to back-end in nodejs
  • ManageIQ docker container cannot not be connected with web browser
  • Xcache var_size error
  • Static const int not good enough for array size?
  • What changes can I make to a cloud-endpoint (app-engine) return object before I need a new API versi
  • Excluding multiple values from the array
  • FAILURE: Error Domain=NSURLErrorDomain Code=-1004 “Could not connect to the server.”
  • Upload to my Google Drive with php
  • Android CalendarContract, deleting a recurring event causes all events to disappear on calendar?
  • Use libusb with Delphi on Windows 64-bit?
  • FindAndModify, return array of Objects
  • Memory usage differs greatly (and strangely) between frontend and backend
  • How to distinguish field that requires null=True when blank=True is set in Django models?
  • Find substring in string using locale
  • Mongodb exception, “ MongoCursorException' with message '$ operator made object too large”
  • Majority function in SQL
  • Can I have a variable number of URI parameters or key-value pairs in Laravel 4?
  • as3-flash: any way to access all the instances placed in different frames from document class?
  • Jenkins: FATAL: Could not initialize class hudson.util.ProcessTree$UnixReflection
  • Does it make sense to call System.gc() and Thread.sleep() when working on Bitmaps?
  • Caching attributes in superclass
  • MongoError: Incorrect arguments
  • Switching to Release Build causes runtime error in Web Reference
  • req.body is undefined - nodejs
  • Symfony2: How to get request parameter
  • QuartzCore.framework for Mono Develop
  • Akka Routing: Reply's send to router ends up as dead letters
  • Is there a mandatory requirement to switch app.yaml?
  • Add sale price programmatically to product variations
  • Django query for large number of relationships
  • Why is Django giving me: 'first_name' is an invalid keyword argument for this function?
  • How can I use `wmic` in a Windows PE script?
  • How to push additional view controllers onto NavigationController but keep the TabBar?