I want to create a json string that contains a list of long values with the following structure: {"document_ids":[23461504,20639162,20395579]}
I solved the problem with the line below, but I feel like I could do it with a cleaner command(string.Format).
var json = "{\"document_ids\":" + JsonConvert.SerializeObject(My List<long>) + "}";
But the command I write with string.Format gives an error message.
var json = string.Format("{\"document_ids\":{0}}", JsonConvert.SerializeObject(My List<long>));
I get this error message. System.FormatException: 'Input string was not in a correct format.'
You can serialize an anonymous object having such a
document_idsproperty.