Attempting to send request data from JavaScript to Java using JSON format. In JavaScript, the request body appears as:
{
"id": "3",
"name": "Chicken pasta",
"description": "Lets make chicken pasta",
"category": "Unassigned",
"favorite": true,
"prepTime": "",
"cookTime": "",
"ingredients": [
{}
],
"steps": [],
"user": {
"id": "2",
"username": "user2"
}
}
However, on the server side (in my Java controller), it is represented as:
%7B%0A%09%22id%22%3A+%223%22%2C%0A%09%22name%22%3A+%22Chicken+pasta%22%2C%0A%09%22description%22%3A+%22Lets+make+chicken+pasta%22%2C%0A%09%22category%22%3A+%22Unassigned%22%2C%0A%09%22favorite%22%3A+true%2C%0A%09%22prepTime%22%3A+%22%22%2C%0A%09%22cookTime%22%3A+%22%22%2C%0A%09%22ingredients%22%3A+%5B%0A%09%09%7B%7D%0A%09%5D%2C%0A%09%22steps%22%3A+%5B%5D%2C%0A%09%22user%22%3A+%7B%0A%09%09%22id%22%3A+%222%22%2C%0A%09%09%22username%22%3A+%22user2%22%0A%09%7D%0A%7D=
This results in a JSON parsing exception. How can I resolve this encoding issue?