Skip to content

MarshalIndentWithOption is failing with UnorderedMap #417

Closed
@abhimanyu003

Description

@abhimanyu003

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions