I have a JSON response body that contains an id within a web request that I previously called for . I'm attempting to use the substring between to fetch the ID, but it's unsuccessful at finding it. The substring I'm using is
I'm trying to extract the number 357636
FindID:
{{webhookResponse.body.substringBetween("id=", ",")}}
The JSON response was
{queryType=flat, queryResultType=workItem, asOf=2024-10-04T19:26:34.07Z, columns=[{referenceName=System.Id, name=ID, url=https://abc.com/123/_apis/wit/fields/System.Id}, {referenceName=System.Title, name=Title, url=https://abc.com/123/_apis/wit/fields/System.Title}], workItems=[{id=357636, url=https://abc.com/123/2049fc05-e304-4422-b2be-d7c00d1f17d5/_apis/wit/workItems/357636}]}
Gave it a shot and still didn't work. Any other function that I could use to test? I've also tried
SearchforID:{{webhookResponse.body.substringAfter("id=").substringBefore(",")}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
To be honest, I'm having trouble parsing anything from that JSON body
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Trying to use structured text by treating it as a string is always tricky, it's better to parse it properly, but that's not an option within smart values that I know of.
A JSON parsing package is part of Groovy (groovy.json.JsonSlurper). You might have an easier time using ScriptRunner.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.