-
Notifications
You must be signed in to change notification settings - Fork 664
How to find a item based on a key
Mathias Rangel Wulff edited this page Jun 13, 2015
·
4 revisions
Source: StackOverflow.com
Given a JSON object like:
var data = {items: [
{value: "21", name: "Mick Jagger"},
{value: "43", name: "Johnny Storm"},
{value: "46", name: "Richard Hatch"},
{value: "54", name: "Kelly Slater"},
{value: "55", name: "Rudy Hamilton"},
{value: "79", name: "Michael Jordan"}
]};
How can I do something like this:
datagood = data.where(value == 55)
Is something like that possible with JS?
AlaSQL library can perform more complex queries with "old good" SQL:
var res = alasql('SELECT * FROM ? WHERE value = 55',[data]);
Try this example in jsFiddle
© 2014-2024, Andrey Gershun & Mathias Rangel Wulff
Please help improve the documentation by opening a PR on the wiki repo