|
|
|
@ -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]
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|