Skip to content
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

Remove RawJSON #363

Open
kegsay opened this issue Apr 14, 2023 · 0 comments
Open

Remove RawJSON #363

kegsay opened this issue Apr 14, 2023 · 0 comments

Comments

@kegsay
Copy link
Member

kegsay commented Apr 14, 2023

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

No branches or pull requests

1 participant