Skip to content

MarshalIndentWithOption is failing with UnorderedMap #417

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
abhimanyu003 opened this issue Dec 26, 2022 · 0 comments · Fixed by #435
Closed

MarshalIndentWithOption is failing with UnorderedMap #417

abhimanyu003 opened this issue Dec 26, 2022 · 0 comments · Fixed by #435

Comments

@abhimanyu003
Copy link

Hello,
There looks like an issue when using the option UnorderedMap with MarshalIndentWithOption.
Mostly it will timeout for me.
But It's taking forever to Marshal Json

Example code:

	var obj map[string]*json.RawMessage
	data := `{\n  \"b\": \"b\",\n \"a\": \"a\"}`
	s, _ := strconv.Unquote(`"` + data + `"`)
	json.Unmarshal([]byte(s), &obj)
	fmt.Println(s)
	output, _ := json.MarshalIndentWithOption(obj, "", " ", json.UnorderedMap())
	fmt.Println(string(output))

Playground: https://go.dev/play/p/8ERpUAccldx

orisano added a commit to orisano/go-json that referenced this issue Feb 25, 2023
…ap is specified

fixed negative overflow on appendObjectEnd
fixed output on appendColon and appendObjectEnd

fix goccy#417
orisano added a commit to orisano/go-json that referenced this issue Mar 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant