go
go copied to clipboard
Incorrect formatting of nested JSON indentation
right usage
m := make(map[string]interface{})
m["json.maxItemsComputed"] = 8000
m["C_Cpp.formatting"] = "Disabled"
m["workbench.iconTheme"] = "vscode-icons-mac"
m["C_Cpp.autocomplete"] = "Disabled"
m["editor.folding"] = map[string]interface{}{
"ssss": 123,
}
s, _ := jsoniter.MarshalIndent(m, "", " ")
fmt.Println(string(s))

wrong usage
m := make(map[string]interface{})
m["json.maxItemsComputed"] = 8000
m["C_Cpp.formatting"] = "Disabled"
m["workbench.iconTheme"] = "vscode-icons-mac"
m["C_Cpp.autocomplete"] = "Disabled"
m["editor.folding"] = map[string]interface{}{
"ssss": 123,
}
cfg := jsoniter.Config{
SortMapKeys: true,
EscapeHTML: false,
}.Froze()
s, _ := cfg.MarshalIndent(m, "", " ")
fmt.Println(string(s))

same problem: https://go.dev/play/p/nCOu2IroD0E
I want to use sort, how can i solve it?
Seems not active for too long. The same issue #564 has been open for half a year 😞
Hitting the same issue.