github.com/intel-go/fastjson@v0.0.0-20170329170629-f846ae58a1ab/README.md (about)

     1  # fastjson: optimized standard library JSON for Go
     2  
     3  `fastjson` has the same API as json from standard library `encoding/json`. 
     4  The `Unmarshal` and `Decode` functions are faster, but everything else is the same as `encoding/json`
     5  
     6  ## Getting Started
     7  ```
     8  $go get github.com/intel-go/fastjson
     9  ```
    10  ##Perfomance
    11  The performance depends on the content of your json structures, not the structure you parse to.
    12  If `.json` has a lot of strings or numbers, fastjson is significantly faster than `encoding/json`
    13  
    14  
    15  ##Example
    16  ```Go
    17  import (
    18      "github.com/intel-go/fastjson"
    19      "fmt"
    20  )
    21  
    22  func main() {
    23      var jsonBlob = []byte(`[
    24  	{"Name": "Platypus", "Order": "Monotremata"},
    25  	{"Name": "Quoll",    "Order": "Dasyuromorphia"}
    26      ]`)
    27      type Animal struct {
    28  	Name  string
    29  	Order string
    30      }
    31      var animals []Animal
    32      err := fastjson.Unmarshal(jsonBlob, &animals)
    33      if err != nil {
    34  	fmt.Println("error:", err)
    35      }
    36      fmt.Printf("%+v", animals)
    37      // Output:
    38      // [{Name:Platypus Order:Monotremata} {Name:Quoll Order:Dasyuromorphia}]
    39  }
    40  ```
    41  ##API
    42  API is the same as encoding/json
    43  [GoDoc](https://golang.org/pkg/encoding/json/#Unmarshal)