Hi,
I am struggling with converting a JSON structure to ABAP data.
The JSON looks like
{
"_id": "string",
"error": "string",
"request": "string",
"predictions": [
{
"name": "string",
"results": [ {
"label": "string",
"score": 0
}
]
}
],
"status": "QUEUED",
"tenantName": "string",
"error_description": "string"
}and I tried with creating a nested ABAP structure like
types: begin of classificationResults_s,
label type string,
score type string,
end of classificationResults_s.
types: results type standard table of classificationResults_s with non-unique default key.
types: begin of prediction_s,
name type string,
results type results,
end of prediction_s.
types: predictions type table of prediction_s with non-unique default key.
TYPES: BEGIN OF response,
_id TYPE string,
error TYPE string,
request type string,
predictions type predictions,
status type string,
tenantName type string,
error_description type string,
END OF response.
data: wa_response type response.
CALL METHOD /UI2/CL_JSON=>DESERIALIZE
EXPORTING
JSON = response
CHANGING
DATA = wa_responseBut that never gives me any result.
When I try with a structure containing only one internal table everything works just fine. However, when introducing the second layer (results in this case) the deserialization returns an empty data structure.
Any help is appreciated.