I have two JSONs (as simple strings) - is there neat way to concat them? As part of the infrastructure??
We can merge two JSON objects using the putAll() method (inherited from interface java.
Use concat() for arrays Assuming that you would like to merge two JSON arrays like below: var json1 = [{id:1, name: 'xxx' ...}] var json2 = [{id:2, name: 'xyz' ...}]
This is a simple tool for merging multiple data. json files into one.
If you just want to merge all json files sequentially, go to the folder where all json files are, select all and rename the first one as "yourchoice", by doing this all will be in sequential order i.e. yourchoice1,yourchoice2 ... next go to cmd and type : copy *. json "outputfilename".
string j1 = @"{""a"":1}";
string j2 = @"{""b"":2}";
var j = JsonConvert.SerializeObject(new[] { JsonConvert.DeserializeObject(j1),
JsonConvert.DeserializeObject(j2) });
or
var j = JsonConvert.SerializeObject(new { obj1 = JObject.Parse(j1),
obj2 = JObject.Parse(j2) });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With