Get value from JSON data

Hi team ,

This is my json -

[{“WD_ExceptionID”:“WD-0003”,“WD_ExceptionMessage”:“Company Address is not matching with workday custom report”},{“WD_ExceptionID”:“WD-0003”,“WD_ExceptionMessage”:“Supplier Address is not matching with workday custom report”}]

I just want to obtain all the “WD_ExceptionMessage” in different lines.
How to achieve this after deserializing?


we deserialize to a JArray:

can loop over it by:

or using LINQ:

arrExtractResult =
yourJArrayVar.SelectTokens("$..WD_ExceptionMessage").Select(Function (x) x.Value(Of String)).ToArray

bringing this array to flatten string with Linebreaks we can do:
String.Join(Environment.NewLine, arrExtractResult)

1 Like

Hello @gokul1904

You need to use like

item.SelectToken(“WD_ExceptionMessage”) inside the for each


Kindly note: we do have two methods

SelectTokens <-s - retrieval all founds

And SelectToken ← without s - retrieve first found

Hi @gokul1904 ,

Could also try with an Alternate, direct convert to Datatable :

DT = Newtonsoft.Json.JsonConvert.DeserializeObject(Of Datatable)(strJson)

Here, strJson is the Json data (JArray) that you have in string format.


1 Like

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