|
| Iniciado por guest, 27,abr. 2016 16:52 - 7 respuestas |
| |
| | | |
|
| |
| Publicado el 27,abril 2016 - 16:52 |
Hello all,
I had a simular question before with JSON, now i have a web API to receive dutch adres information and can't exctract a JSON string with JSONTOVARIANT(). Below the json data i receive. Is there anyone with a solution? I tried a lot of things but nothing works!
{"_embedded":{"addresses":[{"city":{"id":"3594","label":"Amsterdam"},"letter":null,"id":"0363200000158443","purpose":null,"postcode":"1012NX","municipality":{"id":"0363","label":"Amsterdam"},"nen5825":{"street":"KALVERSTRAAT","postcode":"1012 NX"},"street":"Kalverstraat","number":1,"province":{"id":"27","label":"Noord-Holland"},"addition":null,"geo":{"center":{"wgs84":{"crs":{"properties":{"name":"urn:ogc:def:crs:OGC:1.3:CRS84"},"type":"name"},"type":"Point","coordinates":[4.89214047794,52.3725040602]},"rd":{"crs":{"properties":{"name":"urn:ogc:def:crs:EPSG::28992"},"type":"name"},"type":"Point","coordinates":[121286,487296]}}},"type":"Verblijfsobject","_links":{"self":{"href":"https://postcode-api.apiwise.nl/v2/addresses/0363200000158443/"}}}]},"_links":{"self":{"href":"https://postcode-api.apiwise.nl/v2/addresses/…"}}}
Thanks, Sammy |
| |
| |
| | | |
|
| | |
| |
| Publicado el 28,abril 2016 - 15:45 |
With the code below i recieve in sAlgemeen the data as in my first post, but by Info(VAlgemeen.city.street) i recieve 0.
Gelukt = HTTPRequest(sPcurl)
IF Gelukt THEN sAlgemeen is ANSI string = HTTPGetResult(httpResult) ELSE Error("Fout in www.postcodeapi.nu, probeer op een later tijdstip opnieuw.") END
VAlgemeen is Variant
VAlgemeen = JSONToVariant(sAlgemeen)
Info(VAlgemeen.city.street) |
| |
| |
| | | |
|
| | |
| |
| Publicado el 29,abril 2016 - 11:59 |
Nobody any experience with this? Then i start looking for another database with dutch adresses. |
| |
| |
| | | |
|
| | |
| |
| Publicado el 29,abril 2016 - 12:48 |
Hi Sammy,
What is your real problem...
I never heard about 'JSON' data but i saw it's something like XML.
Don't' you see all the data you need in the message or do you want to extract the data in a easy way ? (JSONToVariant) |
| |
| |
| | | |
|
| | |
| |
| Publicado el 29,abril 2016 - 12:56 |
Hello Harry,
I want to extract the data, but with JSONToVariant() i don`t receive something. Mayby there is another way to extract the data. |
| |
| |
| | | |
|
| | |
| |
| Publicado el 29,abril 2016 - 13:44 |
Hi Sammy,
If I do a vVariant=JSONToVariant(yourstring) I get the right values in the Variant variable
sJSON is ANSI string vVariant is Variant sJSON = [ {"_embedded":{"addresses":[{"city":{"id":"3594","label":"Amsterdam"},"letter":null,"id":"0363200000158443","purpose":null,"postcode":"1012NX","municipality":{"id":"0363","label":"Amsterdam"},"nen5825":{"street":"KALVERSTRAAT","postcode":"1012 NX"},"street":"Kalverstraat","number":1,"province":{"id":"27","label":"Noord-Holland"},"addition":null,"geo":{"center":{"wgs84":{"crs":{"properties":{"name":"urn:ogc:def:crs:OGC:1.3:CRS84"},"type":"name"},"type":"Point","coordinates":[4.89214047794,52.3725040602]},"rd":{"crs":{"properties":{"name":"urn:ogc:def:crs:EPSG::28992"},"type":"name"},"type":"Point","coordinates":[121286,487296]}}},"type":"Verblijfsobject","_links":{"self":{"href":"https://postcode-api.apiwise.nl/v2/addresses/0363200000158443/"}}}]},"_links":{"self":{"href":"https://postcode-api.apiwise.nl/v2/addresses/…"}}} ] vVariant=JSONToVariant(sJSON) Info(vVariant._embedded.addresses[1].city.label) Info(vVariant._embedded.addresses[1].postcode) //... |
| |
| |
| | | |
|
| | |
| |
| Publicado el 29,abril 2016 - 14:10 |
Peter,
Thank you very much!
My fault was in the addresses[1]  Now it works.
Sammy |
| |
| |
| | | |
|
| | |
| |
| Publicado el 30,abril 2016 - 12:36 |
Hi Any I deas How this works if jsontovarriant is not availeble. Iam trying to do some map stuff in php modus but in php modus the jsaontovarriant isnot availeble. The fault message states something to use like compile with ?? Anyone an Idea ?
I get the json bac via httpresult but cannot handle it ??
regards Allard |
| |
| |
| | | |
|
| | | | |
| | |
|