你好,
这就是标准的json字符串,你意思是把中文转为\uxxxx吗?
用JsonGenerator重新生成Json串:
string ls_json, ls_Path, ls_json2
Long ll_Return, ll_item
JsonGenerator lnv_JsonGenerator
lnv_JsonGenerator = Create JsonGenerator
ls_json = '{"touser":"oJdQp6FiYmoPF0Mk6ef-aa","template_id":"RtP5_NgqozjErem7Ju-rgUfKv3sG1TH74EJeeee","data":{"first":{"value":"物资(项目)采购比价提醒"},"keyword1":{"value":"2022-11-22"},"keyword2":{"value":"电动润滑泵采购"},"keyword3":{"value":"截止时间:2022-11-25"},"keyword4":{"value":"余祖赢"},"keyword5":{"value":"比价单单号:1-20221122-0003"},"remark":{"value":"请对应项目供应商尽快提供比价单"}}}'
ll_Return = lnv_JsonGenerator.importstring( ls_json)
ls_Path = "/touser"
ll_item = lnv_JsonGenerator.GetItemBypath(ls_Path)
MessageBox("", ll_item)
ls_json2 = lnv_JsonGenerator.GetJsonString( )
MessageBox("", ls_json2)
用JsonParser解析json串:
JsonParser lnv_JsonParser
String ls_Json, ls_name
Long ll_RootObject, ll_item
lnv_JsonParser = Create JsonParser
ls_Json = '{"touser":"oJdQp6FiYmoPF0Mk6ef-aa","template_id":"RtP5_NgqozjErem7Ju-rgUfKv3sG1TH74EJeeee","data":{"first":{"value":"物资(项目)采购比价提醒"},"keyword1":{"value":"2022-11-22"},"keyword2":{"value":"电动润滑泵采购"},"keyword3":{"value":"截止时间:2022-11-25"},"keyword4":{"value":"余祖赢"},"keyword5":{"value":"比价单单号:1-20221122-0003"},"remark":{"value":"请对应项目供应商尽快提供比价单"}}}'
lnv_JsonParser.LoadString(ls_Json)
ll_RootObject = lnv_JsonParser.GetRootItem()
ll_item = lnv_JsonParser.GetChildItem(ll_RootObject, 2)
ls_name = lnv_JsonParser.GetItemString(ll_item)
MessageBox("",ls_name )
ls_name = lnv_JsonParser.GetItemString("/data/first/value")
MessageBox("",ls_name )