Issue with Table REST API Post request
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2025 08:54 AM
I have a table that should hold JSON in a field, u_body. When I send a post request to the table API with valid JSON which looks something like
{"u_body": [{"DATA": "123","SERIAL_ID":"ABC123"...}]}
I get a 201 success request, but the string in u_body and the post response string for u_body doesn't look like the JSON I sent. It ends up being like
"{[DATA=1234,SERIAL_ID=ABC123...]}"
Has anyone experienced this? If so, what is the fix to preserve the original JSON so I can actually use it and don't get stuck with the incorrectly formatted string?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2025 09:09 AM
ServiceNow automatically converts JSON objects into JavaScript objects (GlideElements) when storing them in a table. It replaces : with = and removes quotes.
Try this
{
"u_body": "{\"DATA\": \"123\",\"SERIAL_ID\":\"ABC123\"}"
}
Please Mark it helpful
Regards
Priyatam
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2025 10:30 AM
Hi @Cam14 ,
try sending the data in this format
{"origins":"[{\"Critical Update Instruction Flow.2bf457f553143110a8edddeeff7b12a9\":\"2bf457f553143110a8edddeeff7b12a9\",\"Critical Update Instruction Flow.a67a673d53543110a8edddeeff7b12a8\":\"a67a673d53543110a8edddeeff7b12a8\",\"Critical Update Instruction Flow\":\"f8e2d4361172021008ddf292ecbfee14\",\"Critical Update Instruction Flow.7dea6e7d53503110a8edddeeff7b12ee\":\"7dea6e7d53503110a8edddeeff7b12ee\"},{\"Critical Update Instruction Flow.2bf457f553143110a8edddeeff7b12a9\":\"2bf457f553143110a8edddeeff7b12a9\",\"Critical Update Instruction Flow.a67a673d53543110a8edddeeff7b12a8\":\"a67a673d53543110a8edddeeff7b12a8\",\"Critical Update Instruction Flow\":\"f8e2d4361172021008ddf292ecbfee14\",\"Critical Update Instruction Flow.7dea6e7d53503110a8edddeeff7b12ee\":\"7dea6e7d53503110a8edddeeff7b12ee\"}]"}
Please mark my answer as helpful/correct if it resolves your query.
Regards,
Chaitanya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2025 11:12 AM
Thanks. That works, but I just need regular JSON.