How to read "status" value from below json?

{“transactionId”:“pqrstuvwxy”,“invokingUser”:“Digital People”,“timestamp”:“2021-12-06T07:57:22.836Z”,“data”:[{“created_by”:“Digital People”,“created_date”:“2021-12-01T11:20:30.000Z”,“modified_by”:“abc”,“modified_date”:“2021-12-01T11:20:30.000Z”,“ir_id”:“INC12345623”,“config_item”:“PQ RST”,“status”:“Assigned”]}

@anjasing

  1. Write this Json text into notepad file.

  2. And then use Read Text File activity to read the text from notepad file and it will give output as String. Let’s say stringJson.

  3. And then use Deserialize Json activity and pass above stringJson to it and it will give output as Json Object. Let’s say jsonObject.

  4. And then use below expression to get status.

         jsonObject("data")("status").ToString
    

jsonObject(“data”)(“status”).ToString
Let me know if you need more details

@anjasing

There was an issue with the JSON you have mentioned

make sure you copied all the tags

you can also check the JSON is in correct format by copying the json result to a text file and paste the result in https://codebeautify.org/jsonviewer and click beautify, IF there are errors in JSON result then you can to see

After the correct JSON you can follow steps mentioned by @lakshman

Thanks

Hi It’s giving below error
image
please help

@anjasing
as mentioned by others, the JSON has to be corrected:
grafik
checked with: https://jsonlint.com/

data property has a JArray value, which is to handle within the retrieval statement:
grafik
Line2: is retrieving the status from first data JArray item - (0) Access

It is recommended to grab the value with the help of Value function as we can control the returned datatype:
grafik
myJObject("data")(0)("status").Value(Of String)

In case of more items are present within the JArray we can pass the items to a for each by:
myJObject("data").Values(Of JObject)
grafik

1 Like

Thank you so much
slight_smile: myJObject(“data”)(0)(“status”).Value(Of String)
This worked

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.