Hi, I have followed the tutorials however I am struggling to extract content out of json array to a variable. I am trying to do this with ServiceNow however I had the same issue with “https://api.coinmarketcap.com/v1/ticker/ripple/” using the cmc example, I do a web request writing out to a string variable which I can check with a write line. However after that, if I try to Deserialise the json to a jarray or jobject I get an error option strict on disallows converting from string to int. I am sure I am just messing up the data type but some help would be appreciated.
HI Arivu, Thanks for your assistance.
Can you please post the workflow? I’ve managed to implement a HTTP request to my own developer instance on ServiceNow with no issues.
The output of my HTTPRequest was to a string, to which I performed a deserialization to produce a JObject.
Hi Ollie, Thanks for your reply, I have changed it to JObject as suggested. Where I am falling flat is converting elements within the json to a variable. This is the rest response.
What I want to do is create a variable for incident number, user input, etc. then use the variable in a powershell command to perform a search and destroy on an office 365 tenant. However I am struggling with the syntax to extract the content out the json to a variable. I am trying to use write line however not getting anywhere. I can post the workflow however it is just going to show an incompetent write line function
Hey Chris, no such thing as incompetency! We’re all learning here and it took me a solid day of struggling to extract the data. What worked for me to assign the data from servicenow to a local variable was:
Using the Assign function:
variable1 = jsonDocument(“result”)(0)(“variableInServiceNow”).ToString
Is that a similar thing to what you’re trying to do?
Thanks Ollie, That looks like what I need. I will give it a go an let you know.
Genius!!! Thanks that was perfect.
Fantastic! All the best