https://github.com/chandler767/json-path-flattener
JSON path flattening using Golang
https://github.com/chandler767/json-path-flattener
flatten flattened-json go golang json jsonpath recursion
Last synced: 3 months ago
JSON representation
JSON path flattening using Golang
- Host: GitHub
- URL: https://github.com/chandler767/json-path-flattener
- Owner: chandler767
- Created: 2018-01-17T19:37:47.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-01-18T20:48:31.000Z (over 7 years ago)
- Last Synced: 2025-01-23T04:11:07.416Z (5 months ago)
- Topics: flatten, flattened-json, go, golang, json, jsonpath, recursion
- Language: Go
- Size: 12.7 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# JSON Path Flattening
### How To Use
You can pass a filepath, URL, or string to flatten.
```
go run main.go ~/JSON-path-flattening/sample.json
go run main.go https://raw.githubusercontent.com/chandler767/JSON-path-flattening/master/sample.json
go run main.go "{\"server_ip\":\"192.168.0.1\",\"action\":\"stop\"}"
```A JSON path is a string that uniquely identifies a subvalue inside a JSON
value. For example, given the following JSON:```
{
"books": [
{
"title": "JSON and you",
"pages": 234
}
]
}
```The path `.books` points at the array of books, `.books[0]` points at the first
book, and `.books[0].title` at the title of the first book.Takes **any arbitrary JSON** as input and writes as
output, line-by-line, the path to every scalar value in the JSON, an equals
sign, and the value. The output for the example JSON given above would be:```
.books[0].title=JSON and you
.books[0].pages=234
```