Quantcast
Channel: West Wind Message Board Messages
Viewing all articles
Browse latest Browse all 10393

Re: JSON Serialization

$
0
0
Re: JSON Serialization
West Wind Internet Protocols
Re: JSON Serialization
Feb. 4, 2013
03:17 pm
3PI0WQTC3Show this entire thread in new window
Gratar Image based on email address
From:Roger Bradshaw
To:Rick Strahl
Yes, thank you. The new code did work and once I got the newer DLL in the right spot, that problem went away too.


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





Viewing all articles
Browse latest Browse all 10393

Trending Articles