This commit is contained in:
huangsimin 2018-12-20 11:17:37 +08:00
parent b4bd32c0a2
commit 4fddfe2863

View File

@ -47,13 +47,13 @@ func (tt *Toutiao) ToDoParser(adstring string) (presult string, err error) {
log.Println("test json -----------------------")
var v interface{}
log.Println(label, gjson.Unmarshal([]byte(data), &v), gjson.Parse(data).Exists())
log.Println(label, gjson.Unmarshal([]byte(data), &v), gjson.Parse(data).IsObject())
data = strings.Trim(data, "\"")
unq, _ := strconv.Unquote("\"" + data + "\"")
log.Println(label, gjson.Unmarshal([]byte(data), &v), gjson.Parse(data).Exists())
log.Println(label, gjson.Unmarshal([]byte(data), &v), gjson.Parse(data).IsObject())
data = unq
log.Println(label, gjson.Unmarshal([]byte(data), &v), gjson.Parse(data).Exists())
log.Println(label, gjson.Unmarshal([]byte(data), &v), gjson.Parse(data).IsObject())
result := gjson.Parse(data)
// log.Println(result.String())