Cascading JSON

Oct 23, 2010 at 5:18 AM
Edited Oct 23, 2010 at 5:21 AM

Is there a feature in Json.NET (or another library that would know) to resolve what I would call multi-level cascading JSON?

Here is an example of what I mean:

var json1 = @"{
                     ""firstName"": ""John"",
                     ""lastName"": ""Smith""
                 }";

var json2 = @"{
                     ""firstName"": ""Albert""
                 }";

var json3 = @"{
                     ""phone": ""12345""
                 }";

 

var cascadingJSON = JSON.Cascade(json1, json2, json3);

cascadingJSON == @"{
                     ""firstName"": ""John"", /*Inherited*/
                     ""lastName"": ""Albert"", /*Overridden*/
                     ""phone": ""12345""   }"; /*Added*/

 

Same behavior as CSS.

Thank you for the excellent library.