Go Package encoding: Difference between revisions
Jump to navigation
Jump to search
(→JSON) |
(→JSON) |
||
Line 25: | Line 25: | ||
err = json.NewDecoder(file).Decode(&as) | err = json.NewDecoder(file).Decode(&as) | ||
</pre> | </pre> | ||
=XML= | =XML= |
Revision as of 04:19, 4 April 2016
External
- https://golang.org/pkg/encoding/
- https://golang.org/pkg/encoding/gob
- https://golang.org/pkg/encoding/json
- https://golang.org/pkg/encoding/xml
Internal
Overview
The package "gob" manages streams of gobs - binary values exchanged between an Encoder (transmitter) and a Decoder (receiver). A typical use is transporting arguments and results of remote procedure calls (RPCs) such as those provided by package "net/rpc".
The package "json" provides support for encoding and decoding JSON.
JSON
TODO github recipe
var as []*A err = json.NewDecoder(file).Decode(&as)
XML
TODO github recipe
An example available in "Go in Action" page 56.