cjson.ParseString demo

This commit is contained in:
xushiwei
2024-07-26 16:43:51 +08:00
parent ae50511135
commit e027872f50

View File

@@ -23,6 +23,19 @@ func main() {
mod.SetItem(c.Str("items"), syms) mod.SetItem(c.Str("items"), syms)
cstr := mod.CStr() cstr := mod.CStr()
str := c.GoString(cstr)
c.Printf(c.Str("%s\n"), cstr)
cjson.FreeCStr(cstr)
mod.Delete()
cjsonLoad(str)
}
func cjsonLoad(str string) {
mod := cjson.ParseString(str)
cstr := mod.Print()
c.Printf(c.Str("%s\n"), cstr) c.Printf(c.Str("%s\n"), cstr)
cjson.FreeCStr(cstr) cjson.FreeCStr(cstr)