Convert response from an api Http Request activity into an datatable

Hello I have a string response from an api that looks like this

			""firstname"": ""ANNE"",
			""middlename"": ""M"",
			""lastname"": ""TINER"",
			""address"": ""558 YYII"",
			""city"": ""GHANA"",
			""state"": ""OH"",
			""zipcode"": ""44119"",
			""zip4"": ""3132"",
			""phone"": ""0000000000"",
			""autoyear"": ""1998"",
			""autoclass"": ""CAR BASIC ECONOMY"",
			""automake"": ""TOYOTA"",
			""automodel"": ""COROLLA"",
			""autobody"": ""4DR SEDAN"",
			""autovin"": ""2000000002"",
			""gender"": ""MALE"",
			""income"": ""5000"",
			""insertion_date"": ""2022-07-24 03:12:53""
			""firstname"": ""MARK"",
			""middlename"": null,
			""lastname"": ""GREEN"",
			""address"": ""13 MAX TRL"",
			""city"": ""PONE CITY"",
			""state"": ""AL"",
			""zipcode"": ""3990"",
			""zip4"": null,
			""phone"": ""70000285"",
			""autoyear"": ""2013"",
			""autoclass"": null,
			""automake"": ""CHEVROLET"",
			""automodel"": ""CAMARO"",
			""autobody"": null,
			""autovin"": ""2000000003"",
			""gender"": null,
			""income"": null,
			""insertion_date"": ""2022-07-24 02:52:02""

Please I am trying to get this into a datatable so it looks like this

give a try at following (prototype done with a sample json)

Deserialize the JSON to a JObject - myJObject

then convert it into a datatable as described as above
dtData = JsonConvert.DeserializeObject(Of DataTable)(myJObject("data").ToString)

1 Like

Thank you so much this worked

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