I am using Newtonsoft's Json.Net. I have this Json:
var j1 = {"status_code":"200", "message":"everything is ok"};
and this is the other Json:
var j2 = {"records":[{"id":"1", "name":"file1"},
{"id":"2", "name":"file2"},
{"id":"3", "name":"file3"}]
};
Basically the second j2 is list (array) of files in a directory. It might be empty:
{"records":"[]"}
What I want: is to append (concat, merge) j2 to end of j1 like this:
var j3 = {
"status_code":"200",
"message":"everything is ok",
"records":[{"id":"1", "name":"file1"},
{"id":"2", "name":"file2"},
{"id":"3", "name":"file3"}]
};
// NOTE: the array does NOT have double quots ("")
How can I accomplish this with JsonConvert.Serialize() or any other ways in Newtonesoft's Json.NET?