O'Reilly logo

Go Standard Library Cookbook by Radomir Sohlich

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How it works...

Besides the Unmarshall function, the json package also contains the Decoder API. With NewDecoder, the Decoder could be created. By calling the Token method on the decoder, the underlying Reader is read and returns the Token interface. This could hold multiple values.

One of these is the Delim type, which is a rune containing one of the {, [, ], } characters. Based on this, the beginning of the JSON array is detected. With the More method on the decoder, more objects to decode could be detected.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required