nfJson

Rating:        Based on 1 rating
Reviewed:  1 review
Downloads: 498
Released: Sep 28, 2016
Updated: Oct 6, 2016 by mplazac
Dev status: Stable Help Icon

Downloads

Application nfJson.zip
application, 85K, uploaded Sep 29 - 498 downloads

Release Notes

2016/09/28
minor bug fix: zero item collections created as 1 empty item collection
proper indent for raw/formatted collection objects

2016/08/16:
nfJsonPerfTest:
added compiled exe
samples file ships as a separate file for you to edit
fixed bug on test prgs:
clean installs would fail due to missing temp folder on ditribution zip w/o tests\temp folder
fixed bug on collectionTest

2016/07/22:
nfJsonRead: Improved error management
CollectionTest: added new test

2016/07/20:
  • Fixed bug: missing closing curly brace on collections as object member
  • Updated collections program test

2016/07/09:
  • Automatic cast for datetime properties ( ISO-8601 basic format & vfp compilant as described on https://en.wikipedia.org/wiki/ISO_8601#Times. )
  • nfJsonToCursor Bug Fix: "Date/datetime evaluated to an invalid value" while running under "strictdate = 1" converting empty dates back from Json

2016/07/04:
  • Added support for control characters encoding ( chr( 0) ~ chr(31) )

2016/05/05:
  • invalid Json error shows calling program information

2016/04/02:
  • complex nested objects/arrays validation
  • missing object/array closures validation

2016/03/28:
  • nfJsonRead performs JSON validation: invalid Json throws error indicating reason.
  • nfJsonPerfTest: proper error management enabled for invalid Json input from clipboard
  • nfJsonToCursor: use of strict date format

Functions & Usage:

( Each function is a single prg - No additional dependencies / Requires VFP9 )
  • oJson = nfJsonRead(cJsonString , isFileName,lReviveCollections)
  • cJsonString = nfJsonCreate(oVfp, lFormattedOutput, lNoNullArrayItems,cRootName,aMembersFlag)
  • nfJsonToCursor(cJson, cCursorName , lForceImportFromArray) ( creates cursor back from Json created using nfCursorToJson4vfp )
  • nfCursorToJson4vfp() && converts current open table/cursor to Json suitable for later use of nfJsonToCursor()
  • nfCursorToJson(lReturnArray, lArrayofValues, lIncludestruct, lFormattedOutput) && converts current open table/cursor to Json
  • nfCursorToObject(lCopyToArray, lIncludeStruct)

Tests & Sample files:

  • nfJsonPerfTest.prg: just run it and choose one of the embedded json samples from the list to check performance on your pc. ( Allows you to parse Json from clipboard too. )
  • examples.prg will parse the next Json files included in JsonSamples folder. just run from test folder and see sample code and output.
  • collectionTest.prg: creates a complex collection , converts it to Json and back to vfp.
  • Sample Json files included:
    • youtubesearch.json
    • cycloneForecast.json
    • dropbox.json
    • googleMapsDistance.json
    • iphone photo.json
    • mapquest.json
    • mySimpleArray.json
    • tweeter.json
    • weatherService.json
    • yahooweather.json

Reviews for this release

     
I like it cause it works in vfp 9 perfectly. But nfjsonperftest.PRG is more than 65000 bytes so it can not be used in VFP 8. What to do with nfjson class to enable it for VFP 8?
by AdamAry on Aug 19 at 11:34 AM
nfJson uses alines() features present only on vfp9, and the empty object class. You can try Vilhelm-Ion Praisach's alines() compatible function , kindly shared on this foxite thread: https://www.foxite.com/archives/any-json-parsers-out-there-actually-work-0000419721.htm Additional notes changes needed to source code to add compatibility inside this release. nfJsonperfTest had embedded json samples ( the cause of file size ) , they now ship as a separate file you can edit.
Reply by mplazac (Developer) on Aug 20 at 5:52 PM