Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
01645753
Message ID:
01645977
Views:
46
Thomas, thank you very much! Merry Christmas!

>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
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Reply
Map
View