Hi,
I want to convert Json array into datatable
TxLog: [{“MSISDN”:“96”,“Status”:“Success”,“Error Message”:“”},{“MSISDN”:“96”,“Status”:“Failed”,“Error Message”:“MSISDN”}]
Hi,
I want to convert Json array into datatable
TxLog: [{“MSISDN”:“96”,“Status”:“Success”,“Error Message”:“”},{“MSISDN”:“96”,“Status”:“Failed”,“Error Message”:“MSISDN”}]
Read text file---> Output Json
Deserialize Json Array--->JsonArray
Build data table --->dt
For each JsonArray
Add Data Row--->dt
{currentJToken("MSISDN").ToString(),currentJToken("Status").ToString(),currentJToken("Error Message").ToString()}
Write Range Workbook
Please refer the below code snippets as reference
Hope it helps!!
Hey @Deepak_Rawat
Try this solution:
BlankProcess130.zip (3.5 KB)
lets assume TxLog is the Json String we can do
Assign Activity
dtData | DataType: DataTable =
JArray.Parse(YourJSONStringVar).ToObject(of DataTable)
Hi @Deepak_Rawat ,
Assign jsonString = “{”“TxLog”“:[{”“MSISDN”“:”“96"”,““Status””:““Success””,““Error Message””:“”“”},{““MSISDN””:““96"”,”“Status”“:”“Failed”“,”“Error Message”“:”“MSISDN”“}]}”
Deserialize JSON
Input: jsonString
Output: jObject
Assign jArray = JArray.Parse(jObject(“TxLog”).ToString)
Build Data Table
Columns: MSISDN, Status, Error Message
Output: dt
For Each item in jArray
Add Data Row
DataTable: dt
ArrayRow: {item(“MSISDN”).ToString, item(“Status”).ToString, item(“Error Message”).ToString}
Regards
Sandy
A post was split to a new topic: JSON Transformation into DataTable