# Json Array to data table using assign activity

**URL:** <https://forum.uipath.com/t/json-array-to-data-table-using-assign-activity/498365>\
**Category:** Studio\
**Tags:** system, webapi, activities\
**Created:** [December 12, 2022, 12:32pm UTC](https://forum.uipath.com/t/json-array-to-data-table-using-assign-activity/498365 "2022-12-12T12:32:05Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![santosh\_sai](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/santosh_sai/32/267971_2.png) [@santosh\_sai](https://forum.uipath.com/u/santosh_sai)\
**Post date:** [December 12, 2022, 12:32pm UTC](https://forum.uipath.com/t/json-array-to-data-table-using-assign-activity/498365/1 "2022-12-12T12:32:05Z")

</div>

![error](https://global.discourse-cdn.com/uipath/original/4X/6/e/2/6e2f3fdbb4339751acd95fb505bf4da040539c2a.jpeg)  
i am facing this problem can anyone please help me

---

<div class="post-metadata">

**Author:** ![Gokul001](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/gokul001/32/462734_2.png) [@Gokul001](https://forum.uipath.com/u/Gokul001)\
**Post date:** [December 12, 2022, 12:37pm UTC](https://forum.uipath.com/t/json-array-to-data-table-using-assign-activity/498365/2 "2022-12-12T12:37:45Z")

</div>

HI @santosh_sai

Check out the blog

> **[How to Convert JSON data to DataTable UiPath - RPA Learners](https://rpalearners.com/how-to-convert-json-data-to-datatable-uipath/)**
>
> In this article, we will see how to convert json data to datatable and why converting json data is necessary in Datatable automation

[![](https://global.discourse-cdn.com/uipath/original/4X/4/8/0/480489e86b3773760e1661a1a2f74f84ba5dee62.jpeg "UiPath: Json to DataTable") ](https://www.youtube.com/watch?v=A3oBcGTMng8)

Regards  
Gokul

---

<div class="post-metadata">

**Author:** ![Anil\_G](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/anil_g/32/524291_2.png) [@Anil\_G](https://forum.uipath.com/u/Anil_G)\
**Post date:** [December 12, 2022, 12:41pm UTC](https://forum.uipath.com/t/json-array-to-data-table-using-assign-activity/498365/3 "2022-12-12T12:41:24Z")

</div>

Hi @santosh_sai

is DT of type string or Datatable? Please check that

cheers

---

<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:** [December 12, 2022, 12:59pm UTC](https://forum.uipath.com/t/json-array-to-data-table-using-assign-activity/498365/4 "2022-12-12T12:59:45Z")

</div>

May we ask you to share with the us the JSON / JSON Array sample data? Thanks

---

<div class="post-metadata">

**Author:** ![santosh\_sai](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/santosh_sai/32/267971_2.png) [@santosh\_sai](https://forum.uipath.com/u/santosh_sai)\
**Post date:** [December 12, 2022, 2:07pm UTC](https://forum.uipath.com/t/json-array-to-data-table-using-assign-activity/498365/5 "2022-12-12T14:07:38Z")

</div>

data table

---

<div class="post-metadata">

**Author:** ![santosh\_sai](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/santosh_sai/32/267971_2.png) [@santosh\_sai](https://forum.uipath.com/u/santosh_sai)\
**Post date:** [December 12, 2022, 2:09pm UTC](https://forum.uipath.com/t/json-array-to-data-table-using-assign-activity/498365/6 "2022-12-12T14:09:38Z")

</div>

[data2.txt](https://forum.uipath.com/uploads/short-url/lk3Sj5qYnFWi0Guybs9Niu82DyH.txt) (1.4 KB)

---

<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:** [December 12, 2022, 2:14pm UTC](https://forum.uipath.com/t/json-array-to-data-table-using-assign-activity/498365/7 "2022-12-12T14:14:07Z")

</div>

![grafik](https://global.discourse-cdn.com/uipath/original/4X/3/8/2/3825e702522d2f0ffb11226def0ebc3f31001da8.png)  
` myJObject("data").ToObject(Of DataTable)`

myJObject | DataType: JObject - output form the Deserialize JSON Activity

---

<div class="post-metadata">

**Author:** ![Anil\_G](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/anil_g/32/524291_2.png) [@Anil\_G](https://forum.uipath.com/u/Anil_G)\
**Post date:** [December 12, 2022, 2:14pm UTC](https://forum.uipath.com/t/json-array-to-data-table-using-assign-activity/498365/8 "2022-12-12T14:14:17Z")

</div>

@santosh_sai

Can you try this please

`Newtonsoft.Json.JsonConvert.DeserializeObject(of datatable)(DJson("data").TOString)`

cheers

---

<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:** [December 12, 2022, 2:16pm UTC](https://forum.uipath.com/t/json-array-to-data-table-using-assign-activity/498365/9 "2022-12-12T14:16:26Z")

</div>

in Addition and related to your screenshot:

Ensure that DT or the variable on which thge statement is assigned is of DataType: Datatable

---

<div class="post-metadata">

**Author:** ![santosh\_sai](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/santosh_sai/32/267971_2.png) [@santosh\_sai](https://forum.uipath.com/u/santosh_sai)\
**Post date:** [December 12, 2022, 2:19pm UTC](https://forum.uipath.com/t/json-array-to-data-table-using-assign-activity/498365/10 "2022-12-12T14:19:00Z")

</div>

i have followed the video but in the video in the assign activity i am facing the same problem which is data table cannot be converted to string

in the link that you have shared it is showing the information for a json string but not for a json array so i would like to request you to provide me the solution for the json array  
thank you for your time

---

<div class="post-metadata">

**Author:** ![santosh\_sai](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/santosh_sai/32/267971_2.png) [@santosh\_sai](https://forum.uipath.com/u/santosh_sai)\
**Post date:** [December 12, 2022, 2:19pm UTC](https://forum.uipath.com/t/json-array-to-data-table-using-assign-activity/498365/11 "2022-12-12T14:19:42Z")

</div>

yes i have made it a data table variable only

---

<div class="post-metadata">

**Author:** ![santosh\_sai](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/santosh_sai/32/267971_2.png) [@santosh\_sai](https://forum.uipath.com/u/santosh_sai)\
**Post date:** [December 12, 2022, 2:27pm UTC](https://forum.uipath.com/t/json-array-to-data-table-using-assign-activity/498365/12 "2022-12-12T14:27:27Z")

</div>

i have tried the same but getting same error that data table cannot be changed to string could you provide another solution

---

<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:** [December 12, 2022, 2:30pm UTC](https://forum.uipath.com/t/json-array-to-data-table-using-assign-activity/498365/13 "2022-12-12T14:30:00Z")

</div>

show us your variable panel, defining the variable which is used on the left side from the assign statement

---

<div class="post-metadata">

**Author:** ![santosh\_sai](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/santosh_sai/32/267971_2.png) [@santosh\_sai](https://forum.uipath.com/u/santosh_sai)\
**Post date:** [December 12, 2022, 2:43pm UTC](https://forum.uipath.com/t/json-array-to-data-table-using-assign-activity/498365/14 "2022-12-12T14:43:00Z")

</div>

thank you all for your valuable time in trying to solve my problem  
the mistake was DT was not data table variable but a string the error has gone

But i am facing another problem which is in continuation to this i request everyone to kindly provide me the solution to this  
in this i have used excel process scope and followed by use excel file and followed by write data table to excel where  
in the what to write field i am using DT (data table variable which i defined earlier )  
there i am getting error as below

 ![error2](https://global.discourse-cdn.com/uipath/original/4X/8/8/1/881170c5010668e32eb2c430a1c896c547bd532b.jpeg)

i would like to request to provide me the solution to this

---

<div class="post-metadata">

**Author:** ![Anil\_G](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/anil_g/32/524291_2.png) [@Anil\_G](https://forum.uipath.com/u/Anil_G)\
**Post date:** [December 12, 2022, 2:47pm UTC](https://forum.uipath.com/t/json-array-to-data-table-using-assign-activity/498365/15 "2022-12-12T14:47:47Z")

</div>

> [@santosh\_sai](#):
>
> getting

@santosh_sai

As I told already the type is string… good that you found that

Can you open the ‘What to write’ and see in advanced editor if something else is also got pasted

cheers

---

<div class="post-metadata">

**Author:** ![santosh\_sai](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/santosh_sai/32/267971_2.png) [@santosh\_sai](https://forum.uipath.com/u/santosh_sai)\
**Post date:** [December 12, 2022, 2:55pm UTC](https://forum.uipath.com/t/json-array-to-data-table-using-assign-activity/498365/16 "2022-12-12T14:55:01Z")

</div>

Excellent @Anil_G what you mentioned is absolutely correct apart from DT something else was also pasted by me ,couldn’t know until it is opened in advanced editor. iam very much thankful to you for providing me the solution and being patient with my problem thank you so much

---

<div class="post-metadata">

**Author:** ![santosh\_sai](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/santosh_sai/32/267971_2.png) [@santosh\_sai](https://forum.uipath.com/u/santosh_sai)\
**Post date:** [December 12, 2022, 3:06pm UTC](https://forum.uipath.com/t/json-array-to-data-table-using-assign-activity/498365/17 "2022-12-12T15:06:44Z")

</div>

variable data type i have mistakenly kept string what u said to check is correct thank you

---

<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:** [December 15, 2022, 3:07pm UTC](https://forum.uipath.com/t/json-array-to-data-table-using-assign-activity/498365/18 "2022-12-15T15:07:09Z")

</div>

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