Write a function that accepts an API response formatted as a JSON string. This function should parse, validate, and map the response JSON based on the following specifications.
Validation of the response should be checked using the value of Response.Status
. If the Status
value is not 'Success'
, then an error should be thrown. A reason string for the response failure can be found at Response.Reason
and should be included with the thrown error's mesasge.
If the response is considered successful, map the result to the following object specification:
report
: The base object containing the reportreport.personal
: A collection of personal information