Utilisation Superobject json
Bonjour a tous,
J'aimerai récupérer le prix et numero de véhicule mais ma méthode n'est pas bonne.
merci
résolu voila comment j'ai fait
voici le code
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
{
"enlevement" : [ "paris" ],
"livraison" : [ "toulouse" ],
"list" : [
{
"elements" : [
{
"tranche" : {
"text" : "210euro",
"value" : 20
},
"vehicule" : {
"text" : "voiture",
"value" : 12
},
"status" : "OK"
}
]
}
],
"status" : "OK"
}
var
json,o,t : ISuperObject;
begin
json := SO(mmo1.Lines.Text);
for o in json[list] do
for t in o[elements] do
begin
showmessage(t.['tranche'].S.['text']);
end;
end; |