PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 24 → Read a JSON in Windev ?
Read a JSON in Windev ?
Débuté par PRADEEP / Satin, 12 jan. 2020 02:07 - 3 réponses
Membre enregistré
6 messages
Posté le 12 janvier 2020 - 02:07
Is it possible to read a JSON from an external website ?
JSONExécute - I get an error when I use this function in Windev "Function not supported in Windev"

[say, read from this link - https://api.github.com/users/mralexgray/repos]

Thanks in Advance.

--
Pradeep
Membre enregistré
3 messages
Posté le 12 janvier 2020 - 14:24
Something like this will do

buf1 is Buffer
v1 is Variant
v2 is Variant
HTTPRequest("https://api.github.com/users/mralexgray/repos")
buf1 = HTTPGetResult(httpResult)
v1 = JSONToVariant(buf1)
FOR EACH v2 OF v1
Trace(v2.id,v2.name)
END

if you are on V24 yo can also use a JSON variable instead of a variant

--

Arie
Membre enregistré
6 messages
Posté le 14 janvier 2020 - 03:42
Thank you for your response.

But I get an error with this code: {"message:"Not Found","https://developer.github.com/v3/repos/…"}

--
Pradeep
Membre enregistré
6 messages
Posté le 14 janvier 2020 - 07:50
Thanks my friend. I decoded the output, and identified that JSON was transmitted as a compressed file - gzip.
I now need to understand the procedure to unzip, within the code.

--
Pradeep