Json Parser help needed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
I have a payload structure and i want to make it dynamic so i am sending the input values like short description description etc in the values also the standard payload structure.
Now i will use json parser and will parse and bring the fileds is there any way i can directly pass the dynmic values of the inputs like drag and drop and set it to the payload structure.
For example the below is my payload
{
"name":"",
"description":"",
"ticketType":"Incident",
"severity":"",
"impact":"",
}
here my name is short_description of the incident,description to description of the incident,severity is urgency and impact is impact of my incident
now if i use parser it will create the root object and inside it will have name,description etc can i set those objects to the input values we can do it using script but is there any other way like directly setting the input variables.
@Ankur Bawiskar any idea ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
The JSON Parser step is read-only. It parses a JSON string into data pills for consumption, but you cannot reverse the flow and "set" values back into those parsed pill slots using drag-and-drop. The pills it creates are output references, not writable fields.
What You Can Do Instead (Without Script)
Inline String Template Approach — If the action you're calling (like a REST step) accepts the payload as a string/text field, you can construct the JSON directly inline by dragging pills into a text template:
{"name":"<drag short_description pill here>","description":"<drag description pill here>","ticketType":"Incident","severity":"<drag urgency pill here>","impact":"<drag impact pill here>"}
In the REST step's Request Body field, you'd literally type the JSON skeleton and then drag-and-drop your input pills into the value positions. Flow Designer will resolve them at runtime.
The catch — this works well for simple, flat payloads but becomes fragile with special characters (quotes, newlines) in your input values, since there's no automatic JSON escaping. A description field with a double quote in it would break the JSON structure.
When You Need Script
For anything beyond simple flat strings, a Script Step is the most reliable approach and only takes a few lines:
(function execute(inputs, outputs) {
outputs.payload = JSON.stringify({
name: inputs.short_description,
description: inputs.description,
ticketType: 'Incident',
severity: inputs.urgency,
impact: inputs.impact
});
})(inputs, outputs);
This handles escaping automatically and is easy to maintain when the payload structure changes.
Summary
The inline string template trick in the REST step body is the closest thing to a pure drag-and-drop solution — no script step needed, and you get pill-based mapping visually. Just be aware of the escaping limitation. For production-grade flows where input data could contain special characters, the script step is a few lines and the safer path.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
45m ago
share screenshots
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
