Hi All, spaces and dots are not taking in request body in scripted rest api
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-11-2024 07:02 AM - edited ‎02-11-2024 07:13 AM
Hi All, in one of my json payload there is a field with the value as "test application", while i am trying to retrieve the data i am only getting the first name that is only test from this value test application. However i am able to create a record in my table but the problem is the record gets created with the name a only test not test application. How to avoid these spaces issues? Help me here
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-12-2024 01:03 AM
Try replacing the ' with " or leave them out on the property names
single quotes when defining property names in an object is not recommended
{
application_id:"12",
application_name:"App name3",
group_id:"123",
group_name:"group name3",
typrofoperation:"group.application_assignment.add"
}
or
{
"application_id":"12",
"application_name":"App name3",
"group_id":"123",
"group_name":"group name3",
"typrofoperation":"group.application_assignment.add"
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-12-2024 01:29 AM
Hi @Venkatesh098765 ,
The error message "Unexpected token in object literal" is indicating that there is a syntax issue in the code that you provided. This error is usually caused by a missing comma, a missing bracket, or a missing quotation mark.
Mark it as helpful and solution proposed if it serves your purpose.
Thanks,
Anand
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-12-2024 01:33 AM
Hi @Venkatesh098765, I share the same view as @Simon Christens. In JSON, keys must be enclosed in double quotes, so try replacing the single quotes with double quotes around the keys and that should resolve the unexpected token error.
Regards,
Sunil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-11-2024 12:01 PM - edited ‎02-11-2024 02:33 PM
It's going to be hard to assist here without proper context and details on the approach you're using.
tips-for-writing-a-quality-community-question
... please update this thread with clear and detailed information of your process, so that the community can better understand and assist.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-11-2024 10:11 PM
Hi Bert,
Thanks for the suggestion. Hope the above msg clears somehow regarding my query?