Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/6543/go-yaml2json
MIRROR
https://github.com/6543/go-yaml2json
converter golang golang-library json jsonschema mirror yaml
Last synced: 17 days ago
JSON representation
MIRROR
- Host: GitHub
- URL: https://github.com/6543/go-yaml2json
- Owner: 6543
- License: mit
- Created: 2022-07-17T13:30:07.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-05-14T13:41:36.000Z (8 months ago)
- Last Synced: 2024-10-31T03:42:15.274Z (2 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
[![Tests](https://ci.codeberg.org/api/badges/6543/go-yaml2json/status.svg)](https://ci.codeberg.org/6543/go-yaml2json)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
[![GoDoc](https://godoc.org/codeberg.org/6543/go-yaml2json?status.svg)](https://godoc.org/codeberg.org/6543/go-yaml2json)
[![Go Report Card](https://goreportcard.com/badge/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
}
}
]
```