Skip to content

6543/go-yaml2json

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-yaml2json

Tests License: MIT GoDoc Go Report Card

Get it on Codeberg

golang lib to convert yaml into json

go get codeberg.org/6543/go-yaml2json
yaml2json.Convert(data []byte) ([]byte, error)
yaml2json.StreamConvert(r io.Reader, w io.Writer) error

Example

Go Playground

yaml:

- name: Jack
  job: Butcher
- name: Jill
  job: Cook
  obj:
    empty: false
    data: |
      some data 123
      with new line      

will become json:

[
  {
    "job": "Butcher",
    "name": "Jack"
  },
  {
    "job": "Cook",
    "name": "Jill",
    "obj": {
      "data": "some data 123\nwith new line\n",
      "empty": false
    }
  }
]