In an existing project I need to parse some JSON into a dataset using TRESTResponseDataSetAdapter
, but I can't get nested fields to work.
As a simplified example, let's say the data is structured like this:
[
{
"category": {
"name": "Animals",
"display": true
},
"label": "Horse"
},
{
"category": {
"name": "Animals",
"display": true
},
"label": "Elephant"
},
...and so on...
]
The dataset has fields with the following field names: label
, category.name
and category.display
.
Only the label
gets successfully retrieved from the JSON, but the nested properties in the category
JSON object do not. The TRESTResponseDataSetAdapter
has NestedElements = true
and NestedElementsDepth = 2
(I also tried 0 and 1).
I'm pretty sure this has worked before upgrading to RAD Studio 10.4, but I'm not 100% sure if it started failing before upgrading to 10.4 or as a result of the upgrade.
I can't really find any good info on how to use nested fields, but I seem to remember reading somewhere that you're supposed to separate the path with dots. Any ideas why it is not working?