Prezados,
Preciso acessar a informação de um array de um JSON mas não consigo.
O JSON:
{
"type": "Feature",
"geometry": {
"type": "MultiPoint",
"coordinates": [
[
-46.592643707037,
-18.6892344592593
]
]
},
"properties": {
"br": "352",
"sg_tp_trecho": "B",
"uf": "MG",
"cd_tp_trecho": "",
"rota": "352BMG",
"data": "2020-10-01",
"km": "165.01"
}
}
Preciso pegar as coordenadas
Estou fazendo assim:
procedure TForm1.Button1Click(Sender: TObject);
var
jData : TJSONData;
jObject : TJSONObject;
s : String;
begin
// this is only a minimal sampling of what can be done with this API
// create from string
jData := GetJSON('{"type": "Feature", "geometry": {"type": "MultiPoint","coordinates": [[-46.592643707037,-18.6892344592593]]},"properties": {"br": "352","sg_tp_trecho": "B","uf": "MG","cd_tp_trecho": "","rota": "352BMG","data": "2020-10-01","km": "165.01"}}');
// output as a flat string
s := jData.AsJSON;
// output as nicely formatted JSON
s := jData.FormatJSON;
// cast as TJSONObject to make access easier
jObject := TJSONObject(jData);
//
s := jObject.FindPath('type').AsString;
s := jObject.FindPath('geometry.type').AsString;
//?????????Não consigo obter os dados da coordinates
end;