Well, this becomes a philosophical discussion immediately.
I could just answer this by saying, "Oh, escape such and such character and then the it'll probably convert to a table object."
Or I could explain the solution properly.
Remember, JSON is actually name/value pairs. Keep in mind the name is the metadata. It is the thing that describes the data. The data (value) part of the pair is actually what you want to save in the database. Saving the name part of the JSON is akin to saving the columnName in columns named generically like, [Col1], [Col2], etc.
Name/Value Pairs
The point here is that what you really have is an object with some properties (names).
If you create an object with those properties and serialize the JSON into that object then it will be much easier to store the data in a properly created DataTable which has columns named for each of the names in your name/value pairs.
Simplify
So, if you want to get to the solution, first you need to simplify. What should you simplify? Your JSON. So, here's the deal, go ahead and alter your JSON so that it is the following:
{"authenticationResultCode":"ValidCredentials"}
That means, one object with a property name of
authenticationResultCode
which has a value of:
ValidCredentials
Now, go and see if that one line of code
Dim result As DataTable = DirectCast(JsonConvert.DeserializeObject(returned, (GetType(DataTable))), DataTable)
will even run with that simple JSON.
I'm guessing that it still will not make sense, because what does that do? Does it name the table
authenticationResultCode
and add a column named
ValidCredentials
? Or does it actually create unnamed table (or default-named table) and then add a column with the name and one row with that value?
Try it and report back. I'm curious to know. I think this simplification will begin to get you there. Let me know.