Getting error while trying to use json with 2 map section | Rest Assured Forum
P
Pratyush mishra Posted on 26/06/2023

i am tryin to implement json with 2 level of Array (2 class approch) but getting error, getting output but also exception :

Body:
{
"firstName": "Ramji",
"lastName": "Singhji",
"programme": "B.tech",
"email": "Ramji@hsc.com",
"courses": {
"name": "java",
"Subject": "python",
"subject": "python"
}
}
{
"timestamp": 1687769349294,
"status": 400,
"error": "Bad Request",
"exception": "org.springframework.http.converter.HttpMessageNotReadableException",
"message": "Could not read document: Can not deserialize instance of java.util.ArrayList out of START_OBJECT token\n at [Source: java.io.PushbackInputStream@23e75d6e; line: 1, column: 98] (through reference chain: com.tej.entity.Student[\"courses\"]); nested exception is com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.util.ArrayList out of START_OBJECT token\n at [Source: java.io.PushbackInputStream@23e75d6e; line: 1, column: 98] (through reference chain: com.tej.entity.Student[\"courses\"])",
"path": "/student"
}
PASSED: TwoMaps

====================================================================================================================================

Also, we tried to add python once but getting python entry 2 times.

Attached all 3 files, it would be greatful if i will get solution for same.


P
Pratyush mishra Replied on 26/06/2023

Attaching one more set of class zip .