https://github.com/6543/go-yaml2json
MIRROR
https://github.com/6543/go-yaml2json
converter golang golang-library json jsonschema mirror yaml
Last synced: about 2 months ago
JSON representation
MIRROR
- Host: GitHub
- URL: https://github.com/6543/go-yaml2json
- Owner: 6543
- License: mit
- Created: 2022-07-17T13:30:07.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-05-14T13:41:36.000Z (about 1 year ago)
- Last Synced: 2025-02-10T22:45:50.242Z (4 months ago)
- Topics: converter, golang, golang-library, json, jsonschema, mirror, yaml
- Language: Go
- Homepage: https://codeberg.org/6543/go-yaml2json
- Size: 33.2 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-yaml2json
[](https://ci.codeberg.org/6543/go-yaml2json)
[](https://opensource.org/licenses/MIT)
[](https://godoc.org/codeberg.org/6543/go-yaml2json)
[](https://goreportcard.com/report/codeberg.org/6543/go-yaml2json)golang lib to convert yaml into json
```sh
go get codeberg.org/6543/go-yaml2json
``````go
yaml2json.Convert(data []byte) ([]byte, error)
yaml2json.StreamConvert(r io.Reader, w io.Writer) error
```## Example
[
**Playground**](https://go.dev/play/p/fBddDCaucNG)
yaml:
```yaml
- name: Jack
job: Butcher
- name: Jill
job: Cook
obj:
empty: false
data: |
some data 123
with new line
```will become json:
```json
[
{
"job": "Butcher",
"name": "Jack"
},
{
"job": "Cook",
"name": "Jill",
"obj": {
"data": "some data 123\nwith new line\n",
"empty": false
}
}
]
```