Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Create HTTP Request object
Message
 
 
To
23/12/2016 19:00:14
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
01645753
Message ID:
01645996
Views:
35
>>Hi,
>>
>>I am still having a problem. This is a question for anybody who may know the answer.
>>
>>Here is my sample Json-formated string:
>>
>>
>>cJsonStr = [{"access_token":"OCu_7Rt","token_type":"bearer","expires_in":1209599,".issued":"Fri, 23 Dec 2016 21:58:29
>> GMT",".expires":"Fri, 06 Jan 2017 21:58:29 GMT"}]
>>
>>
>>When I read this string into an object, as the follows:
>>
>>oJson = nfjsonread( cJsonStr )
>>
>>Then it fails on oJson.count - Count does not exist. I wanted to loop through the elements of this object but cannot find how if the object does not have property .COUNT
>>
>>But I can see all the values of the oJson in the debugger with Name and Value pair. But not loop in code.
>>
>>What am I missing?
>>
>>UPDATE. I can get the value of "access_token", which is what I was looking for. The value is stored in
>>oJson.access_token
>>But I thought - just to understand - that I could loop through the names of this collection (if this object is indeed a collection).
>
>I believe it's not a collection: it's an Empty object to which properties have been added.
>
>To display the contents of the JSON object (note: I'm not taking arrays in consideration)
>
>
>LOCAL ARRAY JsonMembers(1)
>LOCAL LoopIndex AS Integer
>
>FOR m.LoopIndex = 1 TO AMEMBERS(m.JsonMembers, m.oJson, 0)
>
>	? m.JsonMembers[m.LoopIndex], "=", EVALUATE("m.oJson." + m.JsonMembers[m.LoopIndex])
>
>ENDFOR
>
Thank you very much! Merry Christmas.
"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
Next
Reply
Map
View

Click here to load this message in the networking platform