<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"><channel><category>pcsoft.fr.windev</category><copyright>Copyright 2026, PC SOFT</copyright><lastBuildDate>18 Dec 2019 16:12:07 Z</lastBuildDate><pubDate>18 Dec 2019 12:19:00 Z</pubDate><description>Bonjour à tous,&#13;
&#13;
Je sèche sur un point en relation avec des structures, variants et JSON. Il s'agit de pouvoir déterminer plusieurs lieux, avec latitude, longitude, en utilisant une structure pour créer un tableau des divers lieux&#13;
&#13;
Typiquement le fichier à traiter en JSON doit être ainsi :&#13;
&#13;
"locations":[&#13;
{&#13;
"name":"Montanejos",&#13;
"lat":40.064012,&#13;
"lon":-0.523261}&#13;
]&#13;
&#13;
Mon code est :&#13;
&#13;
[code:wl]&#13;
// Pour vérification du format&#13;
gLOCATION est un JSON&#13;
	gLOCATION.locations[1].name = "Montanejos"&#13;
	gLOCATION.locations[1].lat = 40.064012&#13;
	gLOCATION.locations[1].lon = -0.523261&#13;
&#13;
// Description de la structure et du tableau&#13;
	STLocation est une Structure&#13;
		name est une chaîne&#13;
		lat est un entier&#13;
		lon est un entier&#13;
	FIN&#13;
	gtabLocations est un tableau de STLocation&#13;
	gstSingleLocation est un STLocation&#13;
		&#13;
	POUR i=1 À 3&#13;
		gstSingleLocation.name = "Test " + i&#13;
		gstSingleLocation.lat = 40.064012 + i&#13;
		gstSingleLocation.lon = -0.523261 +i&#13;
		&#13;
		TableauAjoute(gtabLocations,gstSingleLocation)&#13;
	FIN&#13;
&#13;
	Info("JSON = ", gLOCATION)&#13;
	&#13;
	gLocationData est un JSON = gtabLocations&#13;
	Info("Tableau de STructure à JSON =",gLocationData)&#13;
&#13;
[/code]&#13;
&#13;
Les données sont bien passées pour le format JSON lorsque la variable est définie de type JSON, mais lors du passage de la tableau de structure à JSON, le terme "locations" n'apparaît pas.&#13;
&#13;
JUSTE:&#13;
&#13;
https://hostimage.windev.io/images/JSONOK_9edd8159bd790ff496042d021b5e6021.jpg&#13;
&#13;
FAUX:&#13;
&#13;
https://hostimage.windev.io/images/JSONKO_f5e389e9d1496b352c3239339ff1a251.jpg&#13;
&#13;
J'ai essayé de créer un tableau de type "locations.nom", "locations.lat", "locations.lon" mais WD n'autorise pas cela, et je n'ai plus d'idées par où chercher... J'ai testé avec les variants, même problème.&#13;
&#13;
Si vous avez une idée ou solution, elle sera la bienvenue.&#13;
Merci, Michel&#13;
&#13;
--&#13;
If it works, don't touch it, don't look at it, AND don't fix it ! No patches, no SP ! JUST DONT FIX IT.</description><ttl>30</ttl><generator>WEBDEV</generator><language>fr_FR</language><link>https://forum.pcsoft.fr/es-ES/pcsoft.fr.windev/235578-structure-variant-json/read.awp</link><title>Structure , variant et JSON</title><managingEditor>moderateur@pcsoft.fr (El moderador)</managingEditor><webMaster>webmaster@pcsoft.fr (El webmaster)</webMaster><item><author>Michel GARCIA</author><category>pcsoft.fr.windev</category><comments>https://forum.pcsoft.fr/es-ES/pcsoft.fr.windev/235578-structure-variant-json-235595/read.awp</comments><pubDate>18 Dec 2019 16:12:07 Z</pubDate><description>Merci à tous les deux... C'est surtout que je dois récupérer un nombre inconnu de paramètres (lieu, lat, lon) pour pouvoir faire…</description><guid isPermaLink="true">https://forum.pcsoft.fr/es-ES/pcsoft.fr.windev/235578-structure-variant-json-235595/read.awp</guid><link>https://forum.pcsoft.fr/es-ES/pcsoft.fr.windev/235578-structure-variant-json-235595/read.awp</link><source url="https://forum.pcsoft.fr/es-ES/pcsoft.fr.windev/235578-structure-variant-json/read.awp">Structure , variant et JSON</source><title>Re: Structure , variant et JSON</title></item><item><author>François C.</author><category>pcsoft.fr.windev</category><comments>https://forum.pcsoft.fr/es-ES/pcsoft.fr.windev/235578-structure-variant-json-235593/read.awp</comments><pubDate>18 Dec 2019 15:50:55 Z</pubDate><description>Oui mais bon visiblement il voulait utiliser le type JSON ;)</description><guid isPermaLink="true">https://forum.pcsoft.fr/es-ES/pcsoft.fr.windev/235578-structure-variant-json-235593/read.awp</guid><link>https://forum.pcsoft.fr/es-ES/pcsoft.fr.windev/235578-structure-variant-json-235593/read.awp</link><source url="https://forum.pcsoft.fr/es-ES/pcsoft.fr.windev/235578-structure-variant-json/read.awp">Structure , variant et JSON</source><title>Re: Structure , variant et JSON</title></item><item><author>=JBO=</author><category>pcsoft.fr.windev</category><comments>https://forum.pcsoft.fr/es-ES/pcsoft.fr.windev/235578-structure-variant-json-235592/read.awp</comments><pubDate>18 Dec 2019 15:44:53 Z</pubDate><description>Bonjour,&#13;
&#13;
J'arrive un peu tard pour proposer une solution basée sur le type variant avec sous-éléments nommés et indicés imbri…</description><guid isPermaLink="true">https://forum.pcsoft.fr/es-ES/pcsoft.fr.windev/235578-structure-variant-json-235592/read.awp</guid><link>https://forum.pcsoft.fr/es-ES/pcsoft.fr.windev/235578-structure-variant-json-235592/read.awp</link><source url="https://forum.pcsoft.fr/es-ES/pcsoft.fr.windev/235578-structure-variant-json/read.awp">Structure , variant et JSON</source><title>Re: Structure , variant et JSON</title></item><item><author>Michel GARCIA</author><category>pcsoft.fr.windev</category><comments>https://forum.pcsoft.fr/es-ES/pcsoft.fr.windev/235578-structure-variant-json-235585/read.awp</comments><pubDate>18 Dec 2019 13:50:09 Z</pubDate><description>Bonjour François C. ! Merci beaucoup, ça marche d'enfer !&#13;
&#13;
Juste pour les réels en lieu et place des entiers, j'avais corrigé …</description><guid isPermaLink="true">https://forum.pcsoft.fr/es-ES/pcsoft.fr.windev/235578-structure-variant-json-235585/read.awp</guid><link>https://forum.pcsoft.fr/es-ES/pcsoft.fr.windev/235578-structure-variant-json-235585/read.awp</link><source url="https://forum.pcsoft.fr/es-ES/pcsoft.fr.windev/235578-structure-variant-json/read.awp">Structure , variant et JSON</source><title>Re: Structure , variant et JSON</title></item><item><author>François C.</author><category>pcsoft.fr.windev</category><comments>https://forum.pcsoft.fr/es-ES/pcsoft.fr.windev/235578-structure-variant-json-235582/read.awp</comments><pubDate>18 Dec 2019 12:49:39 Z</pubDate><description>Edit :&#13;
&#13;
[code:wl]&#13;
STLocation est une Structure, Sérialise = "Locations"&#13;
	name est une chaîne&#13;
	lat est un réel&#13;
	lon est un …</description><guid isPermaLink="true">https://forum.pcsoft.fr/es-ES/pcsoft.fr.windev/235578-structure-variant-json-235582/read.awp</guid><link>https://forum.pcsoft.fr/es-ES/pcsoft.fr.windev/235578-structure-variant-json-235582/read.awp</link><source url="https://forum.pcsoft.fr/es-ES/pcsoft.fr.windev/235578-structure-variant-json/read.awp">Structure , variant et JSON</source><title>Re: Structure , variant et JSON</title></item><item><author>François C.</author><category>pcsoft.fr.windev</category><comments>https://forum.pcsoft.fr/es-ES/pcsoft.fr.windev/235578-structure-variant-json-235581/read.awp</comments><pubDate>18 Dec 2019 12:45:50 Z</pubDate><description>Hello, ca devrait marcher :&#13;
[code:wl]&#13;
// Pour vérification du format&#13;
gLOCATION est un JSON&#13;
gLOCATION.locations[1].name = "Mo…</description><guid isPermaLink="true">https://forum.pcsoft.fr/es-ES/pcsoft.fr.windev/235578-structure-variant-json-235581/read.awp</guid><link>https://forum.pcsoft.fr/es-ES/pcsoft.fr.windev/235578-structure-variant-json-235581/read.awp</link><source url="https://forum.pcsoft.fr/es-ES/pcsoft.fr.windev/235578-structure-variant-json/read.awp">Structure , variant et JSON</source><title>Re: Structure , variant et JSON</title></item></channel></rss>
