PC SOFT

PROFESSIONAL NEWSGROUPS
WINDEVWEBDEV and WINDEV Mobile

Home → WINDEV 2024 → Read a JSON in Windev ?
Read a JSON in Windev ?
Started by PRADEEP / Satin, Jan., 12 2020 2:07 AM - 3 replies
Registered member
6 messages
Posted on January, 12 2020 - 2:07 AM
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
Registered member
6 messages
Popularité : +1 (1 vote)
Posted on January, 12 2020 - 2:24 PM
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
Registered member
6 messages
Posted on January, 14 2020 - 3:42 AM
Thank you for your response.

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

--
Pradeep
Registered member
6 messages
Posted on January, 14 2020 - 7:50 AM
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