Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
peterwald committed Oct 3, 2015
1 parent eb2023f commit 8be94bc
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
3 changes: 1 addition & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2015 exponent-io
Copyright (c) 2015 Exponent Labs LLC

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -19,4 +19,3 @@ 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.

27 changes: 25 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,25 @@
# json-walk
Go library for navigating a stream of json tokens.
[![GoDoc](https://godoc.org/github.com/exponent-io/json-seek?status.svg)](https://godoc.org/github.com/exponent-io/json-seek)
[![Build Status](https://travis-ci.org/exponent-io/json-seek.svg?branch=master)](https://travis-ci.org/exponent-io/json-seek)

# json-seek

Extends the Go runtime's json.Decoder enabling navigation of a stream of json tokens. This package includes a SeekingDecoder which wraps a json.Decoder and extends it to include the SeekTo() method. You should be able to use the SeekingDecoder in any place where a json.Decoder would have been used.

## Installation

go get -u github.com/exponent-io/json-seek

## Usage

import "github.com/exponent-io/json-seek"

var j = []byte(`[
{"Space": "YCbCr", "Point": {"Y": 255, "Cb": 0, "Cr": -10}},
{"Space": "RGB", "Point": {"R": 98, "G": 218, "B": 255}}
]`)

w := json_seek.NewSeekingDecoder(bytes.NewReader(j))
var v interface{}

w.SeekTo(1, "Point", "G")
w.Decode(&v) // v is 218

0 comments on commit 8be94bc

Please sign in to comment.