How to remove slash from encoded json object
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-23-2020 06:30 AM
Hi All,
I created one custom UI page. I got bunch of key value pair data in my object( for example categories). In client script I am creating chart using highchart. I need to pass the object to client script to get chart, but I am getting error while encode the object(in console). Every key and value encode with slash.
please guide me how to remove slash from this object.
Thank you in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-23-2020 07:06 AM
I have seen this when I parsed an object that was already recognized as JSON. What are you getting for the value of the object in the client script - not in this function?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-23-2020 09:44 PM
Hi Brad,
Thank you for your reply,
I am not getting any response in client script. Before call drawAllchartts() function As shown in image I got stuck.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-23-2020 07:40 AM
Hi Raju,
if its a encoded JSON ---convert that to string---> var str = JSON.stringify(categories);
Replace slash everywhere in the string----------->str =str.replace(/\//g,"");
You can convert back to JSON object again using-->var output =JSON.parse(str);
Mark it as correct or helpful if it helps.
Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025