# Get specific values form json file

**URL:** <https://forum.uipath.com/t/get-specific-values-form-json-file/716601>\
**Category:** Studio\
**Tags:** jsonarray, json-obj, deserialize-json, json, jsonobject, studio, webapi, activities\
**Created:** [February 1, 2024, 10:18am UTC](https://forum.uipath.com/t/get-specific-values-form-json-file/716601 "2024-02-01T10:18:27Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mathkar\_kunal](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/mathkar_kunal/32/178620_2.png) [@Mathkar\_kunal](https://forum.uipath.com/u/Mathkar_kunal)\
**Post date:** [February 1, 2024, 10:18am UTC](https://forum.uipath.com/t/get-specific-values-form-json-file/716601/1 "2024-02-01T10:18:27Z")

</div>

Hello,

i need to split below json and need to get values of defects  
check below json  
{

“testExecutionKey”: “P000110-15004”,  
“tests”: [  
{  
“status”: “PASS-PARTIALLY”,  
“testKey”: “P000110-6436”,  
“start”: “2023-11-22T09:43:48+01:00”,  
“executedBy”: “abc”,  
“defects”: [  
“P000110-15008”,  
“P000110-15008.1”  
],  
“evidences”: ,  
“steps”: [  
{  
“status”: “PASS”,  
“defects”: ,  
“evidences”:   
},  
{  
“status”: “EXECUTING”,  
“defects”: [  
“attachment1/P000110-14943”,  
“attachment2/P000110-14944”  
],  
“evidences”:   
}  
],  
“assignee”: “abc”,  
“testEnvironments”: ,  
“iterations”: ,  
“comment”: “null”  
}  
]  
}

i need values under defects which are  
“P000110-15008”,  
“P000110-15008.1”

and values under second defect which is in steps  
“attachment1/P000110-14943”,  
“attachment2/P000110-14944”

let me now how can i achieve this  
one json file contains multiple testKey’s which is under “testExecutionKey” but one json contains only one testExecutionKey  
above is for one test key

---

<div class="post-metadata">

**Author:** ![Krishna\_Raj](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/krishna_raj/32/377808_2.png) [@Krishna\_Raj](https://forum.uipath.com/u/Krishna_Raj)\
**Post date:** [February 1, 2024, 10:20am UTC](https://forum.uipath.com/t/get-specific-values-form-json-file/716601/2 "2024-02-01T10:20:10Z")

</div>

@Mathkar_kunal

> [@How to get specific values form json](https://forum.uipath.com/t/how-to-get-specific-values-form-json/714876/2):
>
> Hi, Can you try the following sample? Sample [Sample20240125-6.zip](https://forum.uipath.com/uploads/short-url/hZRh6PkkWYC6a9yaShyFxzYtydf.zip) (3.8 KB) Regards,

check above thread

---

<div class="post-metadata">

**Author:** ![Mathkar\_kunal](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/mathkar_kunal/32/178620_2.png) [@Mathkar\_kunal](https://forum.uipath.com/u/Mathkar_kunal)\
**Post date:** [February 1, 2024, 10:22am UTC](https://forum.uipath.com/t/get-specific-values-form-json-file/716601/3 "2024-02-01T10:22:12Z")

</div>

here values in array splitting with comma.  
will it get values one by one in array?

---

<div class="post-metadata">

**Author:** ![supriya117](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/supriya117/32/412736_2.png) [@supriya117](https://forum.uipath.com/u/supriya117)\
**Post date:** [February 1, 2024, 10:24am UTC](https://forum.uipath.com/t/get-specific-values-form-json-file/716601/4 "2024-02-01T10:24:11Z")

</div>

Hi @Mathkar_kunal

Deserialize JSON: JSONString → jsonObject

```auto
defectsArray = jsonObject("tests")(0)("defects").ToString
stepsArray = jsonObject("tests")(0)("steps").ToArray
secondDefectsArray = stepsArray(1)("defects").ToString

```

---

<div class="post-metadata">

**Author:** ![pravallikapaluri](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/pravallikapaluri/32/484755_2.png) [@pravallikapaluri](https://forum.uipath.com/u/pravallikapaluri)\
**Post date:** [February 1, 2024, 10:25am UTC](https://forum.uipath.com/t/get-specific-values-form-json-file/716601/5 "2024-02-01T10:25:01Z")

</div>

Hi @Mathkar_kunal

```auto
jsonObject("tests")(0)("defects").ToString

jsonObject("tests")(0)("steps")(1)("defects").ToString

```

 ![image](https://global.discourse-cdn.com/uipath/original/4X/9/e/3/9e30f74cffb1a586c261f7cac4513a6b13544f93.png)  
 ![image](https://global.discourse-cdn.com/uipath/original/4X/c/3/e/c3e599920298dca0489bca1a768b7ff8f39ed496.png)

Hope it helps!!

---

<div class="post-metadata">

**Author:** ![vrdabberu](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/vrdabberu/32/484365_2.png) [@vrdabberu](https://forum.uipath.com/u/vrdabberu)\
**Post date:** [February 1, 2024, 10:26am UTC](https://forum.uipath.com/t/get-specific-values-form-json-file/716601/6 "2024-02-01T10:26:18Z")

</div>

Hi @Mathkar_kunal

Try the below syntaxes:

```auto
defectsValues= String.Join(vbCrLf,JObject("tests")(0)("defects").ToObject(Of JArray).Select(Function(x) x.ToString()).ToArray())

```

```auto
secondDefectsValues= String.Join(vbcrlf,JObject("tests")(0)("steps")(1)("defects").ToObject(Of JArray).Select(Function(x) x.ToString()).ToArray())

```

![image](https://global.discourse-cdn.com/uipath/original/4X/c/a/8/ca8c4f548db1f9683fa396e9af6b892556ce11a3.png)

Regards

---

<div class="post-metadata">

**Author:** ![ppr](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/ppr/32/464097_2.png) [@ppr](https://forum.uipath.com/u/ppr)\
**Post date:** [February 1, 2024, 10:43am UTC](https://forum.uipath.com/t/get-specific-values-form-json-file/716601/7 "2024-02-01T10:43:10Z")

</div>

one of many options which can also be adapted  
 ![grafik](https://global.discourse-cdn.com/uipath/original/4X/b/a/b/babe9888960e2604c7c2dd64f88b3cacf39c1a7d.png)

---

<div class="post-metadata">

**Author:** ![Mathkar\_kunal](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/mathkar_kunal/32/178620_2.png) [@Mathkar\_kunal](https://forum.uipath.com/u/Mathkar_kunal)\
**Post date:** [February 1, 2024, 10:49am UTC](https://forum.uipath.com/t/get-specific-values-form-json-file/716601/8 "2024-02-01T10:49:24Z")

</div>

thanks can u tell how to extract defect from ollowing

{  
“status”: “EXECUTING”,  
“defects”: [  
“P000110-14943”,  
“P000110-149434”  
],  
“evidences”:   
}

need below values  
“P000110-14943”,  
“P000110-149434”

---

<div class="post-metadata">

**Author:** ![Nawazish\_Ahmad](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/nawazish_ahmad/32/262848_2.png) [@Nawazish\_Ahmad](https://forum.uipath.com/u/Nawazish_Ahmad)\
**Post date:** [February 1, 2024, 10:50am UTC](https://forum.uipath.com/t/get-specific-values-form-json-file/716601/9 "2024-02-01T10:50:06Z")

</div>

Hi @Mathkar_kunal

1. Deserialize JSON - Output as **JObj**
2. Use **Assign** Activity with Variable **ArrDefects** - String(Of Array)

And use below expression

> **ArrDefects = If(JObj.SelectToken(“tests[0].defects”) IsNot Nothing, JObj.SelectToken(“tests[0].defects”).ToObject(Of String()), Nothing)**

Hope it will helps you 🙂  
Cheers!!

---

<div class="post-metadata">

**Author:** ![pravallikapaluri](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/pravallikapaluri/32/484755_2.png) [@pravallikapaluri](https://forum.uipath.com/u/pravallikapaluri)\
**Post date:** [February 1, 2024, 10:54am UTC](https://forum.uipath.com/t/get-specific-values-form-json-file/716601/10 "2024-02-01T10:54:16Z")

</div>

> [@Mathkar\_kunal](#):
>
> {  
> “status”: “EXECUTING”,  
> “defects”: [  
> “P000110-14943”,  
> “P000110-149434”  
> ],  
> “evidences”:  
> }

@Mathkar_kunal

```auto
Jsonout("defects").ToString

```

![image](https://global.discourse-cdn.com/uipath/original/4X/4/1/6/416a6f2238609b52f5fd1d7f6c9aed2e07cc8265.png)

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/system/32/182466_2.png) [@system](https://forum.uipath.com/u/system)\
**Post date:** [February 4, 2024, 10:54am UTC](https://forum.uipath.com/t/get-specific-values-form-json-file/716601/11 "2024-02-04T10:54:21Z")

</div>

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