Is it somehow possible to convert a Dictionary Of String, Object to a row and add it to a data table? Each key in the dictionary represents the data column name.
Alternative if I convert the dictionary to a JObject can it then be parsed to a data table row?
{"ID":1,"Submitted":"2023-01-24T08:14:50.3847132Z","Email":"noreply@noreply.com","Name":"John Doe","Readiness":"Ready now (RN)","Potential":"High","Performance":"1"}
As I am building a library it should also work dynamically as only the ID, Submitted, Email and Name are static. But for each process there might be other attributes so the columns of the data table should be populated dynamically.
I have created a Dictionary Of String, Object:
jsonDictionary | New Dictionary (Of String, Object)
Added values to the dictionary:
jsonDictionary(“ID”) | response(“id”)
jsonDictionary(“Submitted”) |response(“submitDate”)
jsonDictionary(“Email”) | response(“responder”)
etc.
I have then create a new data table:
responseDt | New DataTable
And then I am trying to populate the data table:
responseDt | JArray.FromObject(jsonDictionary).ToObject(Of DataTable)