{ "author": { "name": { "first": "Lloyd", "last": "Hilaiel" }, "drinkPref": [ "whiskey", "beer", "wine" ], }, "thing": "JSONSelect site", "license": "(cc) BY-SA" }
JSONSelect is an experimental selector language for JSON.
It makes it easy to access data in complex JSON documents.
It feels like CSS.
Why not give it a try?
{ "name": { "first": "Lloyd", "last": "Hilaiel" }, "favoriteColor": "yellow", "languagesSpoken": [ { "lang": "Bulgarian", "level": "advanced" }, { "lang": "English", "level": "native", "preferred": true }, { "lang": "Spanish", "level": "beginner" } ], "seatingPreference": [ "window", "aisle" ], "drinkPreference": [ "whiskey", "beer", "wine" ], "weight": 172 }
JSONSelect is dedicated to sad code everywhere that looks like this:
if (foo && foo.bar && foo.bar.baz && foo.bar.baz.length > 2) return foo.bar.baz[2]; return undefined;
Lloyd Hilaiel started it, and is surrounded by many awesome contributors.
Dave Herman provided the name, and lots of encouragement.
Mike Hanson gave deep feedback and ideas.
John Resig unwittingly contributed his design thoughts.
The jsonselect.org site design was inspired by Stephen Wildish.
JSON and CSS3 Selectors are the prerequisites to JSONSelect's existence, so thanks to you guys too.
Several different implementations of JSONSelect are available:
JavaScript: Get it documented, or minified (2.9k minified and gzipped). The code is on github.
node.js: npm install JSONSelect
ruby: A gem by Simon Menke: https://github.com/fd/json_select
Something missing from this list? Please, tell me about it.