https://github.com/xuwei-k/pj
fork from https://github.com/softprops/pj
https://github.com/xuwei-k/pj
conscript json scala
Last synced: about 1 year ago
JSON representation
fork from https://github.com/softprops/pj
- Host: GitHub
- URL: https://github.com/xuwei-k/pj
- Owner: xuwei-k
- License: mit
- Created: 2019-07-07T08:28:19.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2025-04-15T22:12:06.000Z (about 1 year ago)
- Last Synced: 2025-04-15T23:20:44.413Z (about 1 year ago)
- Topics: conscript, json, scala
- Language: Scala
- Homepage:
- Size: 98.6 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# pj
Makes json all pretty-like.
## as a conscript app
### install
Installation requires [conscript][cs]
```
cs xuwei-k/pj
```
### usage
Formatting piped data with curl (discarding stderr), use empty `--` flag
```
curl 'http://api.tea.io/time' 2>/dev/null | pj --
{
"tea_time": true
}
```
Formatting json from file and writing to another.
```
pj -f path/to/in.json -o path/to/out.json
```
Formatting inline json
```
pj -j '{"oh":"la,la","datas":[1,2,3,4],"objects":{"waka":"waka"}}'
```
Getting help
```
pj -h
```
## as a library
### install
```scala
libraryDependencies += "com.github.xuwei-k" %% "pj" % "0.1.1"
```
### usage
```
val raw = """{"oh":"la,la","datas":[1,2,3,4],"objects":{"waka":"waka"}}"""
println(pj.Printer(raw))
{
"oh" : "la,la",
"datas" : [ 1, 2, 3, 4 ],
"objects" : {
"waka" : "waka"
}
}
```
Doug Tangren (softprops), Kenji Yoshida (xuwei-k) 2012 -
[cs]: https://github.com/foundweekends/conscript#readme