Skip to content

Commit

Permalink
add diff with other libs in readme
Browse files Browse the repository at this point in the history
  • Loading branch information
nemtsov committed Jul 17, 2013
1 parent 7edffe0 commit 5fb2727
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@ var mask = require('json-mask')
mask({p: {a: 1, b: 2}, z: 1}, 'p/a,z') // {p: {a: 1}, z: 1}
```

The main difference between JSONPath / JSONSelect and this engine is that JSON Mask
**preserves the structure of the original input object**.
Instead of returning an array of selected sub-elements (e.g. `[{a: 1}, {z: 1}]` from example above),
it filters-out the parts of the object that you don't need,
keeping the structure unchanged: `{p: {a: 1}, z: 1}`.

This is important because JSON Mask was designed with HTTP resources in mind,
the structure of which I didin't want to change after the unwanted fields
were masked / filtered.

If you've used the Google APIs, and provided a `?fields=` query-string to get a
[Partial Response](https://developers.google.com/+/api/#partial-responses), you've
already used this language. The desire to have partial responses in
Expand Down

0 comments on commit 5fb2727

Please sign in to comment.