How to extract the exact data from Json file

Hi All,

Am trying to extract the specific data from Json file . Can any of you help me on how to extract:
Data is : {“invoiceNumber”:“Abc- 645687”,“accountNumber”:“DXXX”,“invoiceDate”:“XXXX”,“OrderNumber”:“XXXX”,“soldToDetails”:"; XXXXXXX . "}

I wanted to create a datatable with this data . Can anyone please help.

Thank you

@divyaag

Use Deserialize JSON activity. It will give you an out put of type JsonObject. Lets us say you store the JsonObject to a variable jsonObject. Now you can get values from the JsonObject like below.

jsonObject("OrderNumber").ToString
jsonObject("accountNumber").ToString

Deserialize%20JSON

Read more from the below article.

11 Likes

Thanks @KannanSuresh for the response.

it worked for me

1 Like

Hi,
one possible way how to get given JSON into datatable:
1/ deserialize JSON as described by @KannanSuresh

2/ convert it into dictionary
dic = jsonObject.ToObject(of Dictionary(of string, string))

3/ build datatable using BuildDataTable activity

4/ convert dictionary into datatable
dt = (From row In dic Select dt.Rows.Add(row.Key.ToString,row.Value.ToString)).ToArray.CopyToDataTable

See also How to convert dictionary into data table with out for loop

Cheers

3 Likes

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