I have some json that looks like this:
const json = {
"name": "Peter",
"age": 21
}
Then I call JSON.stringify(json) which gives me the following:
'{"name":"Peter","age":21}'
I want to send data from the UI to my server. Currently I am using POSTMAN for this.
POST
http:localhost:8888/user
Body -> JSON
{
"user": {
"details": '{"name":"Peter","age":21}',
"foo": "bar"
}
}
details here needs to be a string but when I send over the data I get the following error on the server
SyntaxError: Unexpected token } in JSON at position 114
Does anyone have any ideas here?