My JSON data structure is as follows:
const json = {
"name": "Peter",
"age": 21
}
After calling JSON.stringify(json)
, the result is:
'{"name":"Peter","age":21}'
I am currently using POSTMAN to send data from the UI to my server with the following details:
POST
http:localhost:8888/user
Body -> JSON
{
"user": {
"details": '{"name":"Peter","age":21}',
"foo": "bar"
}
}
The problem arises when sending over the data as I receive the error on the server:
SyntaxError: Unexpected token } in JSON at position 114
Any suggestions or solutions to this issue?