Update README.md

fix example on how to deserialize key-value JSON
pull/81/head
Mateusz Kozak 6 years ago committed by GitHub
parent bba54c718c
commit 92a8a1f980
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1278,18 +1278,18 @@ package main
import (
"fmt"
"github.com/emirpasic/gods/lists/arraylist"
"github.com/emirpasic/gods/maps/hashmap"
)
func main() {
list := arraylist.New()
hm := hashmap.New()
json := []byte(`["a","b"]`)
err := list.FromJSON(json)
json := []byte(`{"a":"1","b":"2"}`)
err := hm.FromJSON(json)
if err != nil {
fmt.Println(err)
}
fmt.Println(list) // ArrayList ["a","b"]
fmt.Println(hm) // HashMap map[b:2 a:1]
}
```

Loading…
Cancel
Save