775K看样子字符串不算长
你没说谁?哪?啥?报错
CREATE CURSOR tt (id c(20), hilistCode c(30), hilistName c(80), updtTime c(19)) lcTxt = STRCONV(FILETOSTR("json.txt"), 11) ALINES(laTxt, lcTxt, 1+4, '"data":[{', '},{', '}]') FOR ln1 = 2 TO ALINES(laTxt, lcTxt, 1+4, '"data":[{', '},{', '}]') - 1 ALINES(laStr, laTxt[ln1], ",") APPEND BLANK FOR ln2 = 1 TO 4 && 共31个字段,只取了4个 lc1 = STREXTRACT(laStr[ln2], SPACE(0), ":") lc2 = STREXTRACT(laStr[ln2], ":", SPACE(0)) REPLACE (lc1) WITH &lc2 ENDFOR ENDFOR BROWSE
jsCode = "var json=" + LOWER(STRCONV(FILETOSTR("解析的JSON.txt"),11)) js = CREATEOBJECT("ScriptControl") js.Language = "JavaScript" js.AddCode(jsCode) json = js.CodeObject.json ? json.output.message && "message": "成功" CREATE CURSOR tt (id v(20), hilistCode v(30), hilistName v(30), updtTime v(20)) FOR EACH aJsonData IN json.output.data.data INSERT INTO tt VALUES (aJsonData.id, aJsonData.hilistcode, aJsonData.hilistname, aJsonData.updttime) ENDFOR SELECT * FROM tt