Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Create HTTP Request object
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
01645753
Message ID:
01645975
Views:
64
Jer is some example-code you might find useful:
* OVLB is a class attached to a form. One of its properties is a string containing json-data
* In this example it comes in utf8 which I convert to ansi
thisform.oVLB.cJson = STRCONV(thisform.oVlb.cJson,11)
* Then I create an object just by callimg the functio 
oJson = nfjsonread(thisform.oVLB.cJSon)    && It gets the json string as parameter
Now you habe to see what data you need. You should know what data you get. In my case I have a description which starts like this:
{
"content": [
{
"id": <value>,
"version": 1,
"identifier": <value>,
"isbn": <value>,
"issn": <value>,
"gtin": <value>,
.......
My object know contains an array-property/collection of objects called "content". I can check it in the debugger and see what it contains by itself. Every element is a record. So when I am processing it, I loop through the array:
FOR i = 1 TO ALEN(oJson.content)
   * Within the loop I collect the data needed. For example, the above mentioned field "isbn".
   IF NOT ISNULL(oJson.content[i].isbn)
        replace isbn WITH oJson.content[i].isbn
    ELSE
         replace isbn WITH oJson.content[i].gtin
    Endif   
    .........
Next
I hope this helps a bit.

And now Merry Christmas to you and all others here at UT.

Thomas
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform