I am working with a REST API from C# and utilizing RESTSharp, though this isn't really a question about REST, just some background detail.
To get the dataset I am working with I get a Returned Dictionary<string,object>. Once I make the changes to the data I need to submit, I have to submit the data back as a Dictionary<string, object>[]. What is the simplest way of converting the Dictionary<string, object> directly to a 1 lengthed array?
I know how to do it when creating the Dictionary[] from scratch, but having a brain fart on how to do it with the regular Dictionary already created, and it has over 300 records in it, so don't really want to parse through it.
If I do something like this:
Dictionary<string, object>[] tempArray = new Dictionary<string, object>[]
{
new Dictionary<string, object>{ {"Data", Data } }
};
This ends up with a Data record with the dictionary and that isn't what I want.
Another way to say this, is when I serialize the record to JSON I get back I get this:
{
"rec1": "string",
"rec2": 0
}
When I need to submit it back it needs to be this:
[
{
"rec2": 0,
"rec1": "string"
}]