I have a list of strings, printing out:
["TEST1","TEST2","TEST3"]
How would I go about transforming this data to this JSON formatting?
[
{
"value": "TEST1"
},
{
"value": "TEST2"
},
{
"value": "TEST3"
}
]
I do not plan on creating an object.
Have tried using dictionary and key value pairs as well.
3
Answers
What about this ?
you can try this
but I highly recommend to create a class
json
Basically the same as the others, but using a
foreach
:Gives:
It uses
System.Text.Json
, but it should get the same result if you use the Newtonsoft serializer.