I have a json list of Different Type of objects (Schemaless). however, every row contains the Type of the structure. I need to group it as per their type. I need to group this Json. Input is below
var result = [{ "firstName":"John", "lastName":"Doe", "Type":"Person" },
{ "fruit":"apple", "Type":"Diet" },
{ "length":100, "width":60, "height":30,, "Type":"Measure" },
{ "firstName":"Shivang", "lastName":"Mittal", "Type":"Person" }]
Expected Output:
var persons= [{ "firstName":"John", "lastName":"Doe", "Type":"Person" },
{ "firstName":"Shivang", "lastName":"Mittal", "Type":"Person" }];
var Diets = [{ "fruit":"apple", "Type":"Diet" }];
var Measures = [{ "length":100, "width":60, "height":30,, "Type":"" }];
How can i group it based on their Type in c#?