gopp gopp - 29 days ago 6
JSON Question

POST method is not inserting data into the two database tables

I'm using RestAssured to test an API.

I have the following, wow can I test the post method?

{
"name": "Test",
"email": "test@email.com",
"occupation": [{
"id": 1,
"feature": {
"id": 2
},
"company": 7777,
}]
}


"Occupation" is another table, how can I on both tables?
I have tried this:

.body("{\"name\": \"test\", \"email\": \"test@email.com\", \"occupation\": {\"id\": 15, \"feature\": {\"id\": 15}", \"company\": \"7777\"}}")


But the error


"Can not deserialize instance of java.util.ArrayList out of
START_OBJECT token"


is shown.

dso dso
Answer Source

{\"id\": 15, \"feature\": {\"id\": 15}", \"company\": \"7777\"}}"

Try using JSON array here, too!

f.e.: [{\"id\": 1, \"feature\": {\"id\": 2}", \"company\": \"7777\"}]"