From: | Roger Bradshaw |
To: | Rick Strahl |
Roger,
This code should work:
DO wwJsonSerializer && Load libs *** Create a complex object loCust = CREATEOBJECT("Empty")ADDPROPERTY(loCust,"Name","Rick")ADDPROPERTY(loCust,"Entered",DATETIME())*** Create a nested objectADDPROPERTY(loCust,"Address", CREATEOBJECT("Empty"))ADDPROPERTY(loCust.Address,"Street","32 Kaiea Place")ADDPROPERTY(loCust,"Number",32) loSer = CREATEOBJECT("wwJsonSerializer")*** Serialize into JSON lcJson = loSer.Serialize(loCust) ? lcJson
JsonEncodeString() is an API function in wwipstuff.dll. Either the DLL is not there, or you have an old version that is firing. You might also check for errand versions of wwipstuff in your windows folder that might be gunking stuff up.
If you try this code in the (new) wwClient install folder it should just work.
+++ Rick ---
When attempting the code below to better understand the JSON serializer, I run into problems. I took the code directly from the West Wind Documentation.
The first error I recieve is the property NUMBER is not found. If I ignore that, the next statement returns the error "cannot find entry point JsonEncodingstring in the DLL.
I believe I have the most current wwipstuff and Newtonsoft.Json DLLs installed.
Code -
DO wwJsonSerializer && Load libs
*** Create a complex object
loCust = CREATEOBJECT("Empty")
ADDPROPERTY(loCust,"Name","Rick")
ADDPROPERTY(loCust,"Entered",DATETIME())
*** Create a nested object
ADDPROPERTY(loCust,"Address", CREATEOBJECT("Empty"))
ADDPROPERTY(loCust.Address,"Street","32 Kaiea Place")
ADDPROPERTY(loCust.Number,32)
loSer = CREATEOBJECT("wwJsonSerializer")
*** Serialize into JSON
lcJson = loSer.Serialize(loCust)
? lcJson