https://github.com/cbuschka/go-jsonstream
https://github.com/cbuschka/go-jsonstream
Last synced: 27 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/cbuschka/go-jsonstream
- Owner: cbuschka
- License: mit
- Created: 2021-12-27T11:10:01.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-12-27T19:58:37.000Z (almost 4 years ago)
- Last Synced: 2025-03-05T16:16:34.821Z (7 months ago)
- Language: Go
- Size: 27.3 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license.txt
Awesome Lists containing this project
README
# go-jsonstream
### A json token stream implementation written in golang
## Features
* straight forward api
* structure check
* end state check on Close()## Limitations
* still no character escaping in keys and values
* no reader interface## Usage
```go
package examplesimport (
"github.com/cbuschka/go-jsonstream"
"os"
)func run() error {
wr := jsonstream.NewWriter(os.Stdout)
defer func() {
_ = wr.Close()
}()
if err := wr.WriteObjectStart(); err != nil {
return err
}if err := wr.WriteKeyAndStringValue("key", "value"); err != nil {
return err
}if err := wr.WriteObjectEnd(); err != nil {
return err
}return nil
}
```[example code](./examples/object_example.go)
## License
Copyright (c) 2021 by [Cornelius Buschka](https://github.com/cbuschka).
[MIT](./license.txt)