Jsonselect

JSONSelect defines a language very similar in syntax and structure to CSS3 Selectors.

JSONSelect expressions are patterns which can be matched against JSON documents.

Installing it: npm install jsonselect

Sample usage:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
var select = require('jsonselect');

select(user,{only: '.friends'});

/*
{ friends: 
   [ { username: 'bob', password: 'bob pass' },
     { username: 'joe', password: 'joe pass' },
     { username: 'jeff', password: 'jeff pass' } ] }
*/

select(user,{only: '.friends', except: '.password'});

/*
{ friends: 
   [ { username: 'bob' },
     { username: 'joe' },
     { username: 'jeff' } ] }
*/

P.S: This module is still in the beta phase. Do checkout jsonselect.org

GIF FTW!

jsonselect

Thanks to Lloyd Hilaiel and wish me the very best with this module!

Suggest a module

Comments