forked from toolshed/abra
refactor!: lowercase, hyphenate keys
This will potentially break scripts, so time to discuss!
This commit is contained in:
@ -3,6 +3,7 @@ package jsontable
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"strings"
|
||||
|
||||
"github.com/olekukonko/tablewriter"
|
||||
)
|
||||
@ -109,6 +110,9 @@ func (t *JSONTable) _JSONRenderInner() {
|
||||
}
|
||||
writeChar(t.out, '{')
|
||||
for keyidx, key := range t.keys {
|
||||
key := strings.ToLower(key)
|
||||
key = strings.ReplaceAll(key, " ", "-")
|
||||
|
||||
value := "nil"
|
||||
if keyidx < len(row) {
|
||||
value = row[keyidx]
|
||||
@ -138,10 +142,8 @@ func (t *JSONTable) JSONRender() {
|
||||
|
||||
if t.hasCaption {
|
||||
fmt.Fprintf(t.out, "\"%s\":\"%s\",", t.captionLabel, t.caption)
|
||||
|
||||
}
|
||||
fmt.Fprintf(t.out, "\"%s\":", t.dataLabel)
|
||||
|
||||
}
|
||||
|
||||
// write list
|
||||
|
Reference in New Issue
Block a user