Hi All, spaces and dots are not taking in request body in scripted rest api

Venkatesh098765
Tera Contributor

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

12 REPLIES 12

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"
}

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

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

Bert_c1
Kilo Patron

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.

Hi Bert,

 

Thanks for the suggestion. Hope the above msg clears somehow regarding my query?