> I don't know if JSON serialization is deterministic, but I know a couple
> of cases when it is not.

> If the type or some type inside it has a custom JSON marshaller (method
> MarshalJSON), then if that function's output is not deterministic, the
> whole JSON for the type is not deterministic.

Obviously.

> Another common pitfall with JSON: nil vs empty slice. E.g. []string{} is
> encoded as "[]", while []string(nil) is encoded as "null", while they both
> mean an empty slice in Go

I'm not sure I follow.  I was under the impression that the empty array
and nil are distinct values in Go, even though many functions treat them
the same.

-- Juliusz

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/87ttk8qizr.fsf%40pirx.irif.fr.

Reply via email to