Skip to content

encoding/json: RawMessage marshals as base64 #14493

@niemeyer

Description

@niemeyer

The encoding/json package marshals RawMessage properly or incorrectly as base64 based on whether its container is marshaled by value or as a pointer, which is extremely subtle and trivial to get wrong silently.

It also consistently fails to marshal the RawMessage value properly when used as a map value type.

Sample code demonstrating these problems:

https://play.golang.org/p/bHuvfyb7qB

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions