Go from dictionary to JSON to datatable?

So I have a dictionary with data like…

Name: Paul
City: Miami
Age: 46

I am serializing into JSON so I get:

{“Name”:“Paul”,“City”:“Miami”,“Age”:“46”}

Then I am putting that into a Queue Item (along with other things).

I need to create a datatable from that JSON string, so the datatable will have columns of Name, City, and Age and there will be one row with values Paul, Miami, 46.

I’m struggling getting that JSON string converted to a datatable. It seems like the DeserializeJSON activity should directly do this, but it doesn’t. It gives me an error of “Unexpected JSON token when reading DataTable.”

I tried converting the JSON string from {“Name”:“Paul”…etc} to [“Name”:“Paul”…etc] and now I get an error of “After parsing a value an unexpected error was encounter” line 1 position 12.

This should be so simple.

Serialize Dictionary to JSON, then Deserialize JSON to DataTable

What am I doing wrong?

Figured it out.

Serializing the dictionary to JSON gives me:

{“Name”:“Paul”,“City”:“Miami”,“Age”:“46”}

For whatever reason, the deserialize (into datatable) wants it like this…

[{“Name”:“Paul”,“City”:“Miami”,“Age”:“46”}]

So I just add the [ and ] around the JSON string and it works.

I assume it wants it in that format so if the JSON string contained multiple rows…

[{“Name”:“Paul”,“City”:“Miami”,“Age”:“46”},{“Name”:“Mark”,“City”:“Detroit”,“Age”:“42”}]

…then you’d get a datatable with multiple rows.