File tree 1 file changed +11
-2
lines changed
1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -149,7 +149,7 @@ func (app *App) Run() {
149
149
app .kong .FatalIfErrorf (err , "failed to extract missing fields from source" )
150
150
}
151
151
152
- if source , err = json . Marshal (sourceMap ); err != nil {
152
+ if source , err = jsonMarshal (sourceMap ); err != nil {
153
153
app .kong .FatalIfErrorf (err , "failed to marshal source map" )
154
154
}
155
155
}
@@ -180,7 +180,7 @@ func (app *App) Run() {
180
180
}
181
181
dragoman .JSONMerge (originalOutMap , resultMap )
182
182
183
- marshaled , err := json . MarshalIndent (originalOutMap , "" , " " )
183
+ marshaled , err := jsonMarshal (originalOutMap )
184
184
if err != nil {
185
185
app .kong .FatalIfErrorf (err , "failed to marshal result map" )
186
186
}
@@ -253,3 +253,12 @@ func readAll(r io.Reader) (out []byte, err error) {
253
253
}
254
254
}
255
255
}
256
+
257
+ func jsonMarshal (v any ) ([]byte , error ) {
258
+ var buf bytes.Buffer
259
+ enc := json .NewEncoder (& buf )
260
+ enc .SetEscapeHTML (false )
261
+ enc .SetIndent ("" , " " )
262
+ err := enc .Encode (v )
263
+ return buf .Bytes (), err
264
+ }
You can’t perform that action at this time.
0 commit comments