Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Convert an array string to VFP cursor/array
Message
From
06/01/2017 20:11:34
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
01646369
Message ID:
01646381
Views:
83
Likes (1)
>Hi,
>
>In one place of my app, the response of the Web API call is an "array" (I put the array in quotation marks because this is not exactly a VFP array). The "array" string looks like this:
>
>{"Version":"2.2222","Connected":true}
>
>
>I suppose I can parse this string to get the values. But I was wondering if there is a "better" way to convert this string to an array or a cursor?
>
>TIA

As the handle of the Web API data becomes more complex. you should use a JSON library. Check available offers at VFPX and elsewhere.

For instance, with Marco Plaza's nfJson library:
m.Result = nfjsonread('{"Version":"2.2222","Connected":true}')
? m.Result.version
* shows 2.2222 (string)
? m.Result.connected
* shows .T. (logical)
----------------------------------
António Tavares Lopes
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform