Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Convert an array string to VFP cursor/array
Message
De
06/01/2017 20:11:34
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
01646369
Message ID:
01646381
Vues:
84
J'aime (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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform