Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/say4n/jf
flatten them json
https://github.com/say4n/jf
Last synced: 3 months ago
JSON representation
flatten them json
- Host: GitHub
- URL: https://github.com/say4n/jf
- Owner: say4n
- License: mit
- Created: 2024-04-26T22:52:13.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-04-28T13:34:48.000Z (9 months ago)
- Last Synced: 2024-11-06T18:46:21.360Z (3 months ago)
- Language: Rust
- Size: 27.3 KB
- Stars: 124
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- my-awesome-github-stars - say4n/jf - flatten them json (Rust)
README
# `$ jf`
flatten them json## usage
grab the latest `$ jf` from the [releases tab](https://github.com/say4n/jf/releases/) for your platform
```
$ jf -f foo.json
{"foo.bar.0":"baz"}$ jf --filename foo.json
{"foo.bar.0":"baz"}$ echo '{"foo": {"bar": ["baz"]}}' | jf
{"foo.bar.0":"baz"}
```## options
```
-f, --filename
-s, --separator [default: .]
-p, --pretty
-h, --help Print help
-V, --version Print version
```## intent
handling nested json data is messy, `$ jf` comes to the rescue.
it can turn highly nested json blobs like:
```json
{
"this": {
"is": {
"nested": {
"quite": {
"deep": ["but", "that", "is", "fine"]
}
}
}
},
"some" : [
{
"other": ["stuff"]
}
],
"even": {
"more": "data",
"boolean": true,
"number": 2
}
}
```into
```json
{
"even.boolean": true,
"even.more": "data",
"even.number": 2,
"some.0.other.0": "stuff",
"this.is.nested.quite.deep.0": "but",
"this.is.nested.quite.deep.1": "that",
"this.is.nested.quite.deep.2": "is",
"this.is.nested.quite.deep.3": "fine"
}
```