gojsoncookbook

command
v0.0.0-...-8bdb91b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2024 License: Unlicense Imports: 6 Imported by: 0

Documentation

Overview

Decoding arbitrary nested maps from JSON using generic interface{}s.

Eli Bendersky [https://eli.thegreenplace.net] This code is in the public domain.

Encoding/decoding basic static types.

Eli Bendersky [https://eli.thegreenplace.net] This code is in the public domain.

Decode from a stream, using io.Reader and json.Decoder.

Eli Bendersky [https://eli.thegreenplace.net] This code is in the public domain.

Delayed parsing/unmarshaling with json.RawMessage

Eli Bendersky [https://eli.thegreenplace.net] This code is in the public domain.

Encode into a stream, using io.Writer and json.Encoder.

Eli Bendersky [https://eli.thegreenplace.net] This code is in the public domain.

Generic decoding demonstrating int/float and UseNumber.

Eli Bendersky [https://eli.thegreenplace.net] This code is in the public domain.

Basic generic encoding/decoding with interface{}.

Eli Bendersky [https://eli.thegreenplace.net] This code is in the public domain.

Encoding/decoding maps.

Eli Bendersky [https://eli.thegreenplace.net] This code is in the public domain.

Marshaling a deeply nested map.

Eli Bendersky [https://eli.thegreenplace.net] This code is in the public domain.

Optional struct fields via pointer decoding.

Eli Bendersky [https://eli.thegreenplace.net] This code is in the public domain.

Encoding/decoding pointers.

Eli Bendersky [https://eli.thegreenplace.net] This code is in the public domain.

Encoding/decoding slices.

Eli Bendersky [https://eli.thegreenplace.net] This code is in the public domain.

Custom encoding/marshaling of a struct/type.

Eli Bendersky [https://eli.thegreenplace.net] This code is in the public domain.

Ommitting a struct field when encoding it.

Eli Bendersky [https://eli.thegreenplace.net] This code is in the public domain.

Unmarhalling with an embedded struct.

Eli Bendersky [https://eli.thegreenplace.net] This code is in the public domain.

Fieldtags in structs to map to JSON object key names.

Eli Bendersky [https://eli.thegreenplace.net] This code is in the public domain.

Encoding/decoding structs, omitting empty fields.

Eli Bendersky [https://eli.thegreenplace.net] This code is in the public domain.

Encoding/decoding structs without default-valued fields.

Eli Bendersky [https://eli.thegreenplace.net] This code is in the public domain.

Combines delayed with generic parsing to parse the proper struct type.

Shows how to parse structs that can be distinguished by a field value to dispatch to the proper type.

Eli Bendersky [https://eli.thegreenplace.net] This code is in the public domain.

Encoding/decoding structs.

Eli Bendersky [https://eli.thegreenplace.net] This code is in the public domain.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL