initial commits
commit
b38bf1fe82
|
@ -0,0 +1,19 @@
|
|||
Copyright (c) 2023 Charles Iliya Krempeaux :: http://changelog.ca/
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
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.
|
|
@ -0,0 +1,77 @@
|
|||
# go-jsonpp
|
||||
|
||||
Package **jsonpp** provides tools for **pretty printing JSON**.
|
||||
|
||||
**jsonpp** = **json pretty print**
|
||||
|
||||
## Documention
|
||||
|
||||
Online documentation, which includes examples, can be found at: http://godoc.org/sourcecode.social/reiver/go-jsonpp
|
||||
|
||||
[![GoDoc](https://godoc.org/sourcecode.social/reiver/go-jsonpp?status.svg)](https://godoc.org/sourcecode.social/reiver/go-jsonpp)
|
||||
|
||||
## Example
|
||||
|
||||
Here is an example usage:
|
||||
|
||||
```go
|
||||
import "sourcecode.social/reiver/go-jsonpp"
|
||||
|
||||
// ...
|
||||
|
||||
|
||||
var jsn []byte // <--- contains JSON
|
||||
|
||||
// ...
|
||||
|
||||
jsonpp.PrettyPrint(jsn) // outputs the pretty-printed JSON to the STDOUT.
|
||||
```
|
||||
|
||||
Can also send it to an `io.Writer`
|
||||
|
||||
```go
|
||||
import "sourcecode.social/reiver/go-jsonpp"
|
||||
|
||||
// ...
|
||||
|
||||
|
||||
var jsn []byte // <--- contains JSON
|
||||
|
||||
// ...
|
||||
|
||||
jsonpp.FPrettyPrint(writer, jsn) // outputs the pretty-printed JSON to an io.Writer.
|
||||
```
|
||||
|
||||
Or return it as a `string`:
|
||||
|
||||
```go
|
||||
import "sourcecode.social/reiver/go-jsonpp"
|
||||
|
||||
// ...
|
||||
|
||||
|
||||
var jsn []byte // <--- contains JSON
|
||||
|
||||
// ...
|
||||
|
||||
s := jsonpp.SPrettyPrint(jsn) // returns the pretty-printed JSON as a string.
|
||||
```
|
||||
|
||||
|
||||
## Import
|
||||
|
||||
To import package **jsonpp** use `import` code like the follownig:
|
||||
```
|
||||
import "sourcecode.social/reiver/go-jsonpp"
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
||||
To install package **jsonpp** do the following:
|
||||
```
|
||||
GOPROXY=direct https://sourcecode.social/reiver/go-jsonpp
|
||||
```
|
||||
|
||||
## Author
|
||||
|
||||
Package **jsonpp** was written by [Charles Iliya Krempeaux](http://changelog.ca)
|
Loading…
Reference in New Issue