Skip to content

Remove RawJSON #363

Description

@kegsay

This was vital pre Go 1.8 but since then things have changed:

A RawMessage value now marshals the same as its pointer type.

https://go.dev/doc/go1.8

So the example failure in this comment actually works fine in newer Go versions:

// RawJSON is a reimplementation of json.RawMessage that supports being used as a value type
//
// For example:
//
//	jsonBytes, _ := json.Marshal(struct{
//		RawMessage json.RawMessage
//		RawJSON RawJSON
//	}{
//		json.RawMessage(`"Hello"`),
//		RawJSON(`"World"`),
//	})
//
// Results in:
//
//	{"RawMessage":"IkhlbGxvIg==","RawJSON":"World"}
//
// See https://play.golang.org/p/FzhKIJP8-I for a full example.
type RawJSON []byte

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions