Error in Json Data

Hi All,
I am using Action Centre Activity . Inside Parallel for each I have used Wait for Form Task and Resume activity. I got the output data in Json Format Output.txt and I am trying to create data table with following data from JSON File and convert to data table.How ever I was getting the following error"

1)"subscriptionId":"0068Y00001GhTfhQAF
2)in_TotalRolloverCredit
3)out_Approvedamount\

Output.txt (1.5
Output.txt (1.5 KB)

Can any one help me on this?





@marina.dutta

I believe it is failing in serializing the datatable variable

can you please check properly

cheers

Pass Json as String

Use the Assign Activity variable as “DataTable”

jsonList = JsonConvert.DeserializeObject(Of List(Of JObject))(jsonData)


In Assign activity:


dataTable = (From item In jsonList
             Select New With {
                 .Column1 = item("property1").ToString(),
                 .Column2 = item("property2").ToString(),
                 .Column3 = item("property3").ToString()
             }).ToDataTable()

Regards,

Prasanth Kumar Manivannan

BattleBots!!

@ marina.dutta

@PrasanthManivannan

In my case can you help how to get the Json fields according to the output attached.I have attached the Output Json Txt
Output.txt (1.5 KB)

2)in_TotalRolloverCredit
3)out_Approvedamount\

@Anil_G

How should I deserialize to get data table output?attached my Json output. I need the below three fields
Output.txt (1.5 KB)

2)in_TotalRolloverCredit
3)out_Approvedamount
subscriptionId

@marina.dutta

Use deserialize json activity and from output jobj use as below

in_TotalRolloverCredit - jobj("ItemData")("Data")("in_TotalRolloverCredit").ToString
out_Approvedamount - jobj("ItemData")("Data")("out_Approvedamount").ToString

Could not find the other you need please point it if needed or follow same steps

cheers

@Anil_G

My in_TotalRolloverCredit is of type (Integer/Double) . Trying to convert to String. Getting error.

@marina.dutta

Please use cint(value) value is the remaining formula

Cheers

@Anil_G
cint(dt_Output(“ItemData”)(“Data”)(“in_TotalRolloverCredit”).ToString) ?

@Anil_G

Tried something like this .

@marina.dutta

May I know what type is dt_output

Cheers

@Anil_G

Its System.Data.DataTable

@marina.dutta

The above formula is for deserialized output which is the output of deserialize json activity and type is jobject and not datatable

Cheers

@Anil_G

dt_output should be Object type ot Data Table ?

@Anil_G

Is this correct?

@marina.dutta

You have to reqd the text file into a string variable…

Then use deserialize activity on that string variable and the type should be jobject and not datatable…

From that you need to get the objects as above and add to datatable as needed

Cheers

Hi,

It’s double serialize json string. Can you try the following sample?

image

Sample20230626-4Lv2.zip (3.2 KB)

Regards,