mirror of
https://github.com/json-iterator/go.git
synced 2025-06-03 22:27:26 +02:00
use jsoniter for example
This commit is contained in:
parent
2608d40f2a
commit
46d443fbad
@ -1,10 +1,10 @@
|
|||||||
package jsoniter_test
|
package jsoniter_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/json-iterator/go"
|
"github.com/json-iterator/go"
|
||||||
"os"
|
"os"
|
||||||
"encoding/json"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func ExampleMarshal() {
|
func ExampleMarshal() {
|
||||||
@ -37,7 +37,7 @@ func ExampleUnmarshal() {
|
|||||||
Order string
|
Order string
|
||||||
}
|
}
|
||||||
var animals []Animal
|
var animals []Animal
|
||||||
err := json.Unmarshal(jsonBlob, &animals)
|
err := jsoniter.Unmarshal(jsonBlob, &animals)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("error:", err)
|
fmt.Println("error:", err)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user