commit f1707a9a3f739110209d773e41bcb287c97591fc
parent 516d1730ff54dc802fc6749623cb77095628ecbf
Author: francoispqt <francois@parquet.ninja>
Date: Mon, 29 Oct 2018 22:22:33 +0800
update the readme
Diffstat:
1 file changed, 23 insertions(+), 0 deletions(-)
diff --git a/README.md b/README.md
@@ -172,6 +172,7 @@ func (dec *gojay.Decoder) DecodeBool(v *bool) error
func (dec *gojay.Decoder) DecodeString(v *string) error
```
+All DecodeXxx methods are used to decode top level JSON values. If you are decoding keys or items of a JSON object or array, don't use the Decode methods.
### Structs and Maps
#### UnmarshalerJSONObject Interface
@@ -287,6 +288,28 @@ func main() {
}
```
+#### Decode values methods
+When decoding a JSON object of a JSON array using `UnmarshalerJSONObject` or `UnmarshalerJSONArray` interface, the `gojay.Decoder` provides dozens of methods to Decode multiple types.
+
+Non exhaustive list of methods available (to see all methods, check the godoc):
+```go
+dec.Int
+dec.Int8
+dec.Int16
+dec.Int32
+dec.Int64
+dec.Uint8
+dec.Uint16
+dec.Uint32
+dec.Uint64
+dec.String
+dec.Time
+dec.Bool
+dec.SQLNullString
+dec.SQLNullInt64
+```
+
+
## Encoding
Encoding is done through two different API similar to standard `encoding/json`: