Convert yaml to json without struct

前端 未结 2 574
北海茫月
北海茫月 2020-12-15 11:35
Services: 
-   Orders: 
    -   ID: $save ID1
        SupplierOrderCode: $SupplierOrderCode
    -   ID: $save ID2
        SupplierOrderCode: 111111

2条回答
  •  猫巷女王i
    2020-12-15 11:48

    https://github.com/ghodss/yaml is "a wrapper around go-yaml designed to enable a better way of handling YAML when marshaling to and from structs". Among other things, it provides yaml.YAMLToJSON method that should do what you want.

提交回复
热议问题