へのアクセスI持って次のようなJSON構造:は、内部JSON値
concurrence: [
{
id: "481-13",
price: "11.5",
concurrent: {
id: 13,
name: "NAME1",
price: "11.5"
}
},
{
id: "481-14",
price: "12.25",
concurrent: {
id: 14,
name: "NAME2",
price: "12.25"
}
}
]
私は
concurrent.id
値を取得できますか
? RADStudioのドキュメントに記載されているFindValue()
メソッドを使用しようとしましたが、少なくとも10.1ベルリンでは存在しません。
は、私はこのような同意アレイにアクセスしています:
concurrents := product.Get('concurrence').JSONValue as TJSONArray;
for j := 0 to concurrents.Size-1 do
begin
concurrent := concurrents.Get(j) as TJSONObject;
json_s := concurrent.Get('id').JsonValue as TJSONString;
my_id := json_s.Value;
json_s := concurrent.Get('price').JsonValue as TJSONString;
my_price := json_s.Value;
json_s := concurrent.FindValue('concurrent.id') as TJSONString;//NOT WORKING
my_concurrent_id := json_s.Value;
end;
インナーconcurrent
値にアクセスするための別の方法はありますか?
はそれだけではなくjson_sです:= concurrent.Get( 'idが')TJSONString – Dsm
としてあなたの最初の「IDを与えること"フィールドではなく、"並行 "の下にあるフィールドです。 JSONの実装が不十分ですが、私はそれに対処しなければなりません。 –
目的の項目を見つけてそのオブジェクトを読み取るまで、配列全体を繰り返します。 –