go icon indicating copy to clipboard operation
go copied to clipboard

Incorrect formatting of nested JSON indentation

Open 93Alliance opened this issue 3 years ago • 4 comments

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))

image

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))

image

93Alliance avatar Feb 27 '22 06:02 93Alliance

same problem: https://go.dev/play/p/nCOu2IroD0E

micln avatar Feb 28 '22 07:02 micln

I want to use sort, how can i solve it?

93Alliance avatar Feb 28 '22 11:02 93Alliance

Seems not active for too long. The same issue #564 has been open for half a year 😞

creekwax avatar Mar 22 '22 07:03 creekwax

Hitting the same issue.

dashaaa avatar Jun 21 '22 22:06 dashaaa