Skip to content

Commit

Permalink
add readme, license
Browse files Browse the repository at this point in the history
  • Loading branch information
janl committed Jul 31, 2011
1 parent 5e00e33 commit 715da7a
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 1 deletion.
20 changes: 20 additions & 0 deletions LICENSE.txt
@@ -0,0 +1,20 @@
Copyright (c) 2011 Jan Lehnardt <jan@apache.org>

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
37 changes: 37 additions & 0 deletions README.md
@@ -0,0 +1,37 @@
# JSON Pointer for Erlang

This is an implementation of [JSON Pointer](http://tools.ietf.org/html/draft-pbryan-zyp-json-pointer-00).

## Usage

Json = {[
{<<"a">>, 1},
{<<"b">>, {[
{<<"c">>, 2}
]}},
{<<"d">>, {[
{<<"e">>, [
{<<"a">>, 3},
{<<"b">>, 4},
{<<"c">>, 5}
]}
]}}
]},

One = jsonpointer:get(Json, <<"/a">>)),
Two = jsonpointer:get(Json, <<"/b/c">>)),
Three = jsonpointer:get(Json, <<"/d/e/0/a">>)),
Four = jsonpointer:get(Json, <<"/d/e/1/b">>)),
Five = jsonpointer:get(Json, <<"/d/e/2/c">>)),

## Building

rebar compile

## Testing

rebar eunit

## License

MIT License.
2 changes: 1 addition & 1 deletion test/jsonpointer_tests.erl
Expand Up @@ -21,7 +21,7 @@ simple_test() ->
?assertEqual(3, jsonpointer:get(Json, <<"/d/e/0/a">>)),
?assertEqual(4, jsonpointer:get(Json, <<"/d/e/1/b">>)),
?assertEqual(5, jsonpointer:get(Json, <<"/d/e/2/c">>)),

?assertEqual(1, jsonpointer:get(Json, "/a")),
?assertEqual(2, jsonpointer:get(Json, "/b/c")),
?assertEqual(3, jsonpointer:get(Json, "/d/e/0/a")),
Expand Down

0 comments on commit 715da7a

Please sign in to comment.