json-iterator / go

A high-performance 100% compatible drop-in replacement of "encoding/json"
http://jsoniter.com/migrate-from-go-std.html
MIT License
13.43k stars 1.03k forks source link

When will the function Marshal return an error? #589

Open XJangel opened 2 years ago

XJangel commented 2 years ago

Hi all, I wanna know when will the funtion Marshal return an error in library json-iterator? Is it the same as library json? Library json shows the following scenes: (1) Channel, complex, and function values cannot be encoded in JSON. Attempting to encode such a value causes Marshal to return an UnsupportedTypeError. (2) JSON cannot represent cyclic data structures and Marshal does not handle them. Passing cyclic structures to Marshal will result in an error. Thanks a lot!