CLOSE ALL
CLEAR ALL
CLEAR

SET PROCEDURE TO qdfoxJSON
JSONStart()

?"JSON Test #6"
?"Version " + JSON.Version
?
?"THIS TEST SHOWS HOW TO ENCODE & DECODE DATA CURSORS AND IMPORT/EXPORT DATA WITH JSONOBJECT"
?
?"Creating data cursor..."

USE customers
SELECT * FROM customers INTO CURSOR Q1 NOFILTER
USE IN customers
??"Done!!"

SELECT Q1
?"","Records:",RECCOUNT()
GO TOP
?"","First record:",custId,custName,custStat
GO BOTTOM
?"","Last record:",custId,custName,custStat


?
?"Encoding data cursor..."
cJSON = JSON.encodeCursor("Q1")
??"Done!!"
?"",LEFT(cJSON,80)+"..."

?
?"Closing data cursor..."
USE IN Q1
??"Done!!"

?
?"Recreating data cursor..."
JSON.parseCursor(cJSON)
??"Done!!"

SELECT Q1
?"","Records:",RECCOUNT()
GO TOP
?"","First record:",custId,custName,custStat
GO BOTTOM
?"","Last record:",custId,custName,custStat

USE IN Q1 
?
?"Test completed"
?
?"For more information, read initial comments at qdfoxJSON.PRG file"

RETURN

