My Delphi application calls a REST API, which produces the following JSON:
{
"status": "success",
"message": "More details",
"data": {
"filestring": "long string with data",
"correct": [
{
"record": "Lorem ipsum",
"code": 0,
"errors": []
}
],
"incorrect": [
{
"record": "Lorem ipsum",
"code": 2,
"errors": [
"First error",
"Second error"
]
}
],
}
}
I now want to work with the data, but I am unable to receive the information stored in the data section. Currently I am trying to receive the data like below:
var
vResponse : TJSONObject;
vData : TJSONObject;
begin
// .. do other stuff ..
vResponse := // call to REST API (Returns a valid TJSONObject I've wrote it into a file)
vData := vResponse.get('data'); // throws error
end;
But this leads to the following error:
Incompatible Types: TJSONObject and TJSONPair
Does anybody know how I can achieve this?