Skip to content

Commit

Permalink
修改json.go引用github.com/bitly/go-simplejson
Browse files Browse the repository at this point in the history
  • Loading branch information
pangwu86 committed Sep 7, 2013
1 parent 7914bce commit a4672c4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions json.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package z
import (
"bytes"
"encoding/json"
simplejson "github.com/bitly/go-simplejson"
"io"
"log"
"strings"
Expand All @@ -28,7 +29,7 @@ func JsonDecode(r io.Reader, v interface{}) error {
}

// 将一个interface{}转换为一个simplejson.Json对象指针返回
func InterfaceToJson(data *interface{}) (*Json, error) {
func InterfaceToJson(data *interface{}) (*simplejson.Json, error) {
// 将interface转换为byte
jsData, jsDataErr := json.Marshal(*data)
if jsDataErr != nil {
Expand All @@ -42,9 +43,9 @@ func InterfaceToJson(data *interface{}) (*Json, error) {
}

// 将Byte转换为一个simplejson.Json对象指针返回
func ByteToJson(data *[]byte) (*Json, error) {
func ByteToJson(data *[]byte) (*simplejson.Json, error) {
// 解析JSON结构
js, jsonErr := NewJson(*data)
js, jsonErr := simplejson.NewJson(*data)
if jsonErr != nil {
return nil, jsonErr
}
Expand Down

0 comments on commit a4672c4

Please sign in to comment.