JIRA REST API response

HI team , I want to extract JIRA ticket details. The API is responding in JSON format and one of the fielded it self is collection. How can I retried values from this for example response is : { a :1, b:2, c:3, d:4, 5 : {x:9, y:8 ,z:8}, g:7 }

Use the Deserialize JSON activity (UiPath.WebAPI.Activities) and then you can retrieve the values from the JSON object. Tons of posts on this in the forums to help you learn how.

In the case of your example, you deserialize into yourJObj, then use Deseralize JSON Array on yourJObj(“5”).ToString to get an array of x, y, and z.

Hi @jast1631 ,

Sequence
’ Step 1: Read JSON response (assuming jsonResponse is already populated)
Assign jsonResponse = “{”“a”“:1, ““b””:2, ““c””:3, ““d””:4, ““5"”:{”“x””:9, ““y””:8, ““z””:8}, ““g””:7}"

Step 2: Deserialize JSON
Deserialize JSON
Input: jsonResponse
Output: jObject

Step 3: Extract top-level fields
Assign a = jObject(“a”).ToObject(Of Integer)()
Assign b = jObject(“b”).ToObject(Of Integer)()
Assign c = jObject(“c”).ToObject(Of Integer)()
Assign d = jObject(“d”).ToObject(Of Integer)()
Assign g = jObject(“g”).ToObject(Of Integer)()

Step 4: Extract nested JSON object
Assign nestedObject = jObject(“5”).ToObject(Of JObject)()

Step 5: Extract fields from the nested JSON object
Assign x = nestedObject(“x”).ToObject(Of Integer)()
Assign y = nestedObject(“y”).ToObject(Of Integer)()
Assign z = nestedObject(“z”).ToObject(Of Integer)()

Log the extracted values
Log Message
Message: $“a: {a}, b: {b}, c: {c}, d: {d}, g: {g}, x: {x}, y: {y}, z: {z}”

Regards
Sandy

I want result I data table format
Please suggest

Example Workflow

Here is a simple example workflow to demonstrate the steps:

  1. HTTP Request:
  • Output: response
  1. Deserialize JSON:
  • Input: response.Content
  • Output: jsonResponse
  1. Assign:
  • To: extractedData
  • Value:
New Dictionary(Of String, Object) From {
    {"a", jsonResponse("a").ToString()},
    {"b", jsonResponse("b").ToString()},
    {"c", jsonResponse("c").ToString()},
    {"d", jsonResponse("d").ToString()},
    {"e_x", jsonResponse("e")("x").ToString()},
    {"e_y", jsonResponse("e")("y").ToString()},
    {"e_z", jsonResponse("e")("z").ToString()},
    {"g", jsonResponse("g").ToString()}
}
  1. Build Data Table:
  • Columns: a, b, c, d, e_x, e_y, e_z, g
  1. Add Data Row:
  • DataTable: yourDataTable
  • ArrayRow:
New Object() {extractedData("a"), extractedData("b"), extractedData("c"), extractedData("d"), extractedData("e_x"), extractedData("e_y"), extractedData("e_z"), extractedData("g")}

By following these steps, you can effectively extract JIRA ticket details from a JSON response and convert them into a DataTable in UiPath. If you need further customization or help, feel free to ask!

Any short way to convert directly ?

No @jast1631 , this is the best approach to go with

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