On Friday, August 11, 2017 at 6:43:39 AM UTC+2, Dmitriy Cherchenko wrote:
>
> Just to make sure: When marshalling a struct, will fields of 
> type json.RawMessage be ignored (simply inserted into the JSON object 
> without further processing)?
>

There's some *slight* processing:
- a check that it's valid JSON.
- removing insignificant whitespace.
- optionally: the HTML-escaping described in the documentation of 
json.Marshal <https://golang.org/pkg/encoding/json/#Marshal> unless you're 
using a json.Encoder with this feature disabled.
but all of that's just a single pass over the string representation while 
copying it to the output 
<https://golang.org/src/encoding/json/indent.go#L15>. There's no 
unmarshal+re-marshal step if that's what you're worried about.

Oh, and if you use json.MarshalIndent() or json.Encoder.SetIndent() there's 
a separate indentation pass, but even that's still just string processing.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to