https://github.com/mattn/go-scan
https://github.com/mattn/go-scan
Last synced: 9 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/mattn/go-scan
- Owner: mattn
- Created: 2013-05-21T12:18:14.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2020-02-28T00:24:21.000Z (almost 6 years ago)
- Last Synced: 2025-03-27T23:01:47.044Z (10 months ago)
- Language: Go
- Size: 20.5 KB
- Stars: 105
- Watchers: 7
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
go-scan
=======
[](https://travis-ci.org/mattn/go-scan)
[](https://coveralls.io/r/mattn/go-scan?branch=HEAD)
Easily way to get the elements via xpath like string
Usage
-----
```go
var js = strings.NewReader(`
{
"foo": {
"bar": [
{
"faz": true,
"moo": ["goo", "mar"]
},
{
"maz": true,
"moo": ["foo", "bar"]
}
]
}
}
`)
var s []string
scan.ScanJSON(js, "/foo/bar[1]/moo", &s) // s should be ["foo", "bar"]
```
Install
-------
```
go get github.com/mattn/go-scan
```
License
-------
MIT: http://mattn.mit-license.org/2013
Author
------
Yasuhiro Matsumoto (mattn.jp@gmail.com)