//Save the JSON object to be parsed to cString f = new file() f.open('whatever.txt') cString = f.gets(f.size('whatever.txt')) f.close() // Added code to the example in the dBASE to save data to a text file cOutfile = 'parsed_data.txt' fOut =new file() fOut.create(cOutfile) j = new json() j.parse(cString) //Check for Errors in string if j.hasParseError() //- returns True if last call to Parse() method encountered an error ?"error code: "+j.getParseErrorCode()//- returns numeric error code ?"error offset: "+j.getErrorOffset() //- returns numeric offset into JSON string where error was encountered ?"parse error: "+j.getParseError() //- returns string describing error (only available in English) else jsonListContent(j) endif fOut.close() function jsonListContent parameters j private x, xtype static depth = -1, indent = 3 jtype = type("j") depth++ if jtype == 'O' // dBASE Object if j.classname $ 'JSON|JSONMEMBER' if j.isObject() if j.membercount() > 0 j.firstmember() for x=1 to j.membercount() if j.member.isObject() or j.member.isArray() // Recursively call this function for subobject or array // Value will print as 'Object' or 'Array' fOut.puts(space(depth*indent)+"*** "+j.member.name+" ***") jsonListContent(j.member) else if depth < 2 fOut.puts( space(depth*indent)+j.member.name+iif(empty(j.member.value),' ',' '+j.member.value) ) endif endif j.nextmember() endfor endif elseif j.isArray() if j.size() > 0 for x = 1 to j.size() etype = j.getat(x) if etype == 'Object' jsonListContent(j.getat(x)) else if depth < 2 fOut.puts(space(depth*indent)+j.getat(x)) endif endif endfor endif endif endif endif depth-- return