This commit is contained in:
Lunny Xiao
2025-08-26 11:20:16 -07:00
parent 9d34a185fe
commit 78624a972e

View File

@ -177,9 +177,14 @@ func outputJSON(f io.Writer, headers []string, values [][]string) {
for j, val := range value {
v, err := json.Marshal(val)
if err != nil {
fmt.Printf("Failed to format JSON for value '%s': %v\n", val, err)
return
}
key, err := json.Marshal(toSnakeCase(headers[j]))
if err != nil {
fmt.Printf("Failed to format JSON for header '%s': %v\n", headers[j], err)
return
}
key, _ := json.Marshal(toSnakeCase(headers[j]))
fmt.Fprintf(f, "%s:%s", key, v)
if j != headersCount-1 {
fmt.Fprintln(f, ",")