I'm trying to serialize a flat object containing only string properties into JSON. What I get is:
{
"Inputs": {
"prop1": "value1",
"prop2": "value2"
}
}
What I need is:
{
"Inputs": [{
"key": "prop1",
"value": "value1"
},
{
"key": "prop2",
"value": "value2"
}
]
}
My first idea was to write a custom converter that would first cast the object to a dictionary (based on https://stackoverflow.com/a/4944547/9806449) and then iterate on the keys to build it into the desired format but it feels like there must be a simpler solution that eludes me.
Any ideas? Thanks!