Are you worried about "Finding Matching content in complicated JSON data structures. There are eight different ways to do this:
JsonSQL
JsonSQL enables you to query data in a json data structure using SQL select statements.
Example:
jsonsql.query("select * from json.channel.items order by title desc",json);
Home: http://www.trentrichardson.com/jsonsql/
JSONPath
JSONPath is like an XPath for the json data structure.
Example:
jsonPath( books, '$..book[(@.length-1)]')
Home: http://goessner.net/articles/JsonPath/
Jfunk
JFunk allows you to retrieve complex JSON or Javascript objects (which will soon be added to the management function. The Design of jFunk API is almost similar to that of jQuery API. It directly copies jQuery APIs, except those for DOM APIs.
Example:
Jf("> vegetables > *[color=Orange]",Food).get();
Home: http://code.google.com/p/jfunk/
TaffyDB
Have you ever noticed that the literal value of a Javascript Object looks like a record? If you wrap them in an array, do they look like a database table? TaffyDB is a Javascript library that provides powerful database functions to implement previous ideas, greatly improving the way you use data in Javascript.
var kelly = friends({id:2}).first();
Home: http://www.taffydb.com/
Linq. js
Linq. js -- the concept in Javascript (see http://msdn.microsoft.com/zh-tw/library/bb397897)
var queryResult2 = Enumerable.From(jsonArray) .Where("$.user.id < 200") .OrderBy("$.user.screen_name") .Select("$.user.screen_name + ':' + $.text") .ToArray();
Home: http://linqjs.codeplex.com/
Home: http://neue.cc/reference.htm
Objeq
Objeq is a simple library that implements Real-Time query of POJSO (Plain-Old JavaScript Objects, common Javascript Objects.
var res = $objeq(data, "age > 40 && gender == 'female' -> name"); // --> Returns ['Jessica']
Home: https://github.com/agilosoftware/objeq
It uses Javascript property setters, so it can only work on newer browsers)
Json: select ()
Use the class CSS selector to query JSON.
.lang:val("Bulgarian") ~ .level
Home: http://jsonselect.org/#tryit
The Javascript Array Filtering Method in Paul's programming Pearl
var a = [1,2,3,4,5,6,7,8,9,10]; // return everything a.where( "( ) => true" ) ; // --> [1,2,3,4,5,6,7,8,9,10] // return even numbers a.where( "( n, i ) => n % 2 == 0" ) ; // --> [2,4,6,8,10] // query first 6 products whose category begins with 'con' using extra param and regular expression products.where( "( el, i, res, param ) => res.length <= 6 && param.test( el.cat )", /^con/i); // using customer table data from SQL Server's northwind database... customers.where( "( el, i, res, param ) => el.country == param", "USA" );
Home: http://www.paulfree.com/28/javascript-array-filtering/#more-28
Currently, this is my favorite method for querying JSON data structures. It is very simple and, according to the author, it is very fast.
The idea behind it is similar to John Resig's JavaScript Micro-Templating: use the correct expression to convert a very simple string into a Javascript function.
Of course, there are more powerful solutions. The prototype implemented by Paul still lacks the syntax check for the filter expression, but I believe you can solve the Javscript syntax check yourself.
Finally, you must decide which one is the best for your project.
Orangevolt, compilation: bole online-Zhou minming
Http://blog.jobbole.com/31166/.