You are not logged in.
Hello,
How to get the second phoneNumbers type element using path (phoneNumbers[1].type) giving home
{
"firstName": "John",
"lastName" : "doe",
"age" : 26,
"address" : {
"streetAddress": "naist street",
"city" : "Nara",
"postalCode" : "630-0192"
},
"phoneNumbers": [
{
"type" : "iPhone",
"number": "0123-4567-8888"
},
{
"type" : "home",
"number": "0123-4567-8910"
}
]
}
Best regards.
Offline
For examples of parsing and using JSON data, take a look at:
https://synopse.info/forum/viewtopic.php?id=4287
https://synopse.info/forum/viewtopic.ph … 236#p31236
Offline
Yes, https://synopse.info/forum/viewtopic.ph … 243#p31243 is a simple alternative too.
If you want something fast, you can also use a record with a nested dynamic array.
It is faster than TDocVariant, and more native to access the members, but a little more code to write to setup the serialization.
Offline
I think his question is how to get the value directly without looping the properties. Something like an xpath ....
If so, I believe that GetValueByPath does not have this functionality.
But take a look at the documentation on methods like GetItemByProp, GetDocVariantByProp, SearchItemByProp
Offline