MCPcopy Create free account
hub / github.com/aws-cloudformation/rain / convertToJSON

Function convertToJSON

cft/format/json.go:69–91  ·  view source on GitHub ↗
(in string)

Source from the content-addressed store, hash-verified

67}
68
69func convertToJSON(in string) string {
70
71 var d yaml.Node
72
73 err := yaml.Unmarshal([]byte(in), &d)
74 if err != nil {
75 panic(err)
76 }
77
78 err = parse.NormalizeNode(&d)
79 if err != nil {
80 panic(err)
81 }
82
83 intermediate := Jsonise(&d)
84
85 out, err := ToJson(intermediate, " ")
86 if err != nil {
87 panic(err)
88 }
89 s := string(out)
90 return s
91}
92
93// converts struct to a JSON formatted string
94func PrettyPrint(i interface{}) string {

Callers 1

StringFunction · 0.85

Calls 3

NormalizeNodeFunction · 0.92
JsoniseFunction · 0.85
ToJsonFunction · 0.70

Tested by

no test coverage detected