Наиболее перспективен, на мой взгляд, JSONSelect поскольку всё остальное мало понятная неудобная хрень. Но json:select() ешё не доделан до конца, там не так много фич, поэтому мы будем страдать.
json:select() http://jsonselect.org/#tryit
".author .drinkPref :first-child"
{
"author": {
"name": {
"first": "Lloyd",
"last": "Hilaiel"
},
"drinkPref": [
"whiskey",
"beer",
"wine"
],
},
"thing": "JSONSelect site",
"license": "(cc) BY-SA"
}
Result: "whiskey"
JSONSelect = require("JSONSelect")
JSONSelect.forEach(".points_to_delete .id",args,function(){
result.push(arguments)
})
jsel https://github.com/dragonworx/jsel
dom.select('count(//*)') === 5;
dom.select('@title') === 'abc';
dom.select('//children/*[1]/@foo') === 'bar';
dom.select('count(//@foo)') === 2;
dom.select('//@foo[2]') === 555;
dom.select('count(//children//*)') === 2;
dom.select('//children/*[2]') === 'val';
dom.select('name(//children/*[2])') === 'string';
dom.select('name(*/*[2])') === 'subData';
dom.select('*/children/*[2]/text()') === 'val';
dom.selectAll('//@foo') === ['bar', 555];
JSPath https://github.com/dfilatov/jspath
Quick example
JSPath.apply(
'.automobiles{.maker === "Honda" && .year > 2009}.model',
{
"automobiles" : [
{ "maker" : "Nissan", "model" : "Teana", "year" : 2011 },
{ "maker" : "Honda", "model" : "Jazz", "year" : 2010 },
{ "maker" : "Honda", "model" : "Civic", "year" : 2007 },
{ "maker" : "Toyota", "model" : "Yaris", "year" : 2008 },
{ "maker" : "Honda", "model" : "Accord", "year" : 2011 }
],
"motorcycles" : [{ "maker" : "Honda", "model" : "ST1300", "year" : 2012 }]
});
Result will be:
['Jazz', 'Accord']
JsonPath http://goessner.net/articles/JsonPath/
$['store']['book'][0]['title'] $.store.book[*].author $..author $.store.* $.store..price $..book[2] $..book[(@.length-1)] $..book[-1:] $..book[0,1] $..book[:2] $..book[?(@.isbn)] $..book[?(@.price<10)] $..*
jLinq http://hugoware.net/Projects/jLinq
//select records
jlinq.from(data.source)
.starts('first', 'a')
.select();
//complex queries - no need to repeat names
//when querying the same field
jlinq.from(data.source)
.starts('first', 'a')
.or('b')
.or('c')
.sort('last')
.select();
//sorting - multiple field
jlinq.from(data.source)
.greater('age', 40)
.sort('age', 'name');
.select();