I need some help about converting JSON object that contains multidimensional array to my class. I tried to deserialize the json object but failed. JsonMaclar class object is null. Please help.
The script code;
var allFields = new Array();
allFields.push({
BirinciKatilimciId: birinciKatilimciId.val(),
IkinciKatilimciId: ikinciKatilimciId.val(),
BirincininSkoru: birincininSkoru.val(),
IkincininSkoru: ikincininSkoru.val(),
MacSayisi: macSayisi.val(),
MacSuresi: macinSuresi.val(),
MacinOynanmaSaati: macinOynanmaSaati.val(),
Hukmen: hukmen.is(':checked'),
RatingeDahil: ratingeDahil.is(':checked'),
MaclarTablosundaGoster: maclarTablosundaGoster.is(':checked'),
MacinTarihi: macinTarihi.val()
});
$("#<%=btnMaclariKaydet.ClientID %>").click(function () {
var jsonText = JSON.stringify({
arrayAllMaclar: allFields
});
$('#<%= hfMaclar.ClientID %>').val(jsonText);
});
c# code;
protected void btnMaclariKaydet_Click(object sender, EventArgs e)
{
JavaScriptSerializer ser = new JavaScriptSerializer();
JsonMaclar turnuvaMaclar = ser.Deserialize<JsonMaclar>(hfMaclar.Value);
}
public class JsonMaclar {
List<JsonMac> arrayAllMaclar { get; set; }
}
public class JsonMac {
String BirinciKatilimciId { get; set; }
String IkinciKatilimciId { get; set; }
String BirincininSkoru { get; set; }
String IkincininSkoru { get; set; }
String MacSayisi { get; set; }
String MacSuresi { get; set; }
String MacinOynanmaSaati { get; set; }
String Hukmen { get; set; }
String RatingeDahil { get; set; }
String MaclarTablosundaGoster { get; set; }
String MacinTarihi { get; set; }
}
I recommend you to use JSON.NET. it is an open source library to serialize and deserialize your c# objects into json and Json objects into .net objects ...
Serialization Example:
Product product = new Product();
product.Name = "Apple";
product.Expiry = new DateTime(2008, 12, 28);
product.Price = 3.99M;
product.Sizes = new string[] { "Small", "Medium", "Large" };
string json = JsonConvert.SerializeObject(product);
//{
// "Name": "Apple",
// "Expiry": new Date(1230422400000),
// "Price": 3.99,
// "Sizes": [
// "Small",
// "Medium",
// "Large"
// ]
//}
Product deserializedProduct = JsonConvert.DeserializeObject<Product>(json);
Json.NET 4.5 Release 8 – Multidimensional Array Support, Unicode Improvements
Json.NET now supports serializing and deserializing multidimensional arrays. There isn't anything you need to do, if one of your types has a multidimensional array property It Just Works™.
string[,] famousCouples = new string[,]
{
{ "Adam", "Eve" },
{ "Bonnie", "Clyde" },
{ "Donald", "Daisy" },
{ "Han", "Leia" }
};
string json = JsonConvert.SerializeObject(famousCouples, Formatting.Indented);
// [
// ["Adam", "Eve"],
// ["Bonnie", "Clyde"],
// ["Donald", "Daisy"],
// ["Han", "Leia"]
// ]
string[,] deserialized = JsonConvert.DeserializeObject<string[,]>(json);
Console.WriteLine(deserialized[3, 0] + ", " + deserialized[3, 1]);
// Han, Leia
Related
var singleItems = new List<Products>();
singleItems.Add(new Products() { product_id = 1, title = "Bryon Hetrick", price = 50 });
singleItems.Add(new Products() { product_id = 2, title = "Nicole Wilcox", price = 20 });
var serializer = new JavaScriptSerializer();
var serializedResult = serializer.Serialize(serializer);
From above example code i am getting Json output like bellow.
[{"product_id":1,"title":"Bryon Hetrick","price":50},
{"product_id":2,"title":"Nicole Wilcox","price":20}]
But my Json need one more value called- "config" also i need whole data formatted exactly like bellow. How to edit my c# code to achieve that value?
{ "products":[{"product_id":"B071H6TBM5","title":"New Iphone 5S","price":"23.45"},{"product_id":"B071DM968J","title":"Iphone 4 old","price":"23.45"}],"config":{"token":"","Site":"Us","Mode":"ListMyItem"}}
You could make a Config class with the properties you require and then a composite class with Prodcuts and Config, i.e. ProductConfig:
public class Products
{
public string product_id { get; set; }
public string title { get; set; }
public string price { get; set; }
}
public class Config
{
public string token { get; set; }
public string site { get; set; }
public string mode { get; set; }
}
public class ProductConfig
{
public List<Products> Products { get; set; }
public Config Config { get; set; }
}
You can then create/populate the ProductConfig class with the new properties.
public string SerializeProductConfig()
{
ProductConfig pc = new ProductConfig();
pc.Config = new Config { token = "DDTest", site = "US", mode = "Test Mode" };
pc.Products = new List<Products>();
pc.Products.Add(new Products() { product_id = "1", title = "Bryon Hetrick", price = "50" });
pc.Products.Add(new Products() { product_id = "2", title = "Nicole Wilcox", price = "20" });
var serializer = new JavaScriptSerializer();
return serializer.Serialize(pc);
}
and serialize the ProductConfig object using the JavaScript serializer or NewtonSoft which will give you the following JSON
{ // ProductConfig
"Products": [
{
"product_id": "1",
"title": "Bryon Hetrick",
"price": "50"
},
{
"product_id": "2",
"title": "Nicole Wilcox",
"price": "20"
}
],
"config": {
"token": "DDTest",
"site": "US",
"mode": "Test Mode"
}
}
Given I have two c# objects of the same type, I want to compare them to create a JsonPatchDocument.
I have a StyleDetail class defined like this:
public class StyleDetail
{
public string Id { get; set; }
public string Code { get; set; }
public string Name { get; set; }
public decimal OriginalPrice { get; set; }
public decimal Price { get; set; }
public string Notes { get; set; }
public string ImageUrl { get; set; }
public bool Wishlist { get; set; }
public List<string> Attributes { get; set; }
public ColourList Colours { get; set; }
public SizeList Sizes { get; set; }
public ResultPage<Style> Related { get; set; }
public ResultPage<Style> Similar { get; set; }
public List<Promotion> Promotions { get; set; }
public int StoreStock { get; set; }
public StyleDetail()
{
Attributes = new List<string>();
Colours = new ColourList();
Sizes = new SizeList();
Promotions = new List<Promotion>();
}
}
if I have two StyleDetail objects
StyleDetail styleNew = db.GetStyle(123);
StyleDetail styleOld = db.GetStyle(456);
I now want to create a JsonPatchDocument so I can send the differences to my REST API... How to do this??
JsonPatchDocument patch = new JsonPatchDocument();
// Now I want to populate patch with the differences between styleNew and styleOld - how?
in javascript, there is a library to do this https://www.npmjs.com/package/rfc6902
Calculate diff between two objects:
rfc6902.createPatch({first: 'Chris'}, {first: 'Chris', last:
'Brown'});
[ { op: 'add', path: '/last', value: 'Brown' } ]
but I am looking for a c# implementation
Let's abuse the fact that your classes are serializable to JSON!
Here's a first attempt at a patch creator that doesn't care about your actual object, only about the JSON representation of that object.
public static JsonPatchDocument CreatePatch(object originalObject, object modifiedObject)
{
var original = JObject.FromObject(originalObject);
var modified = JObject.FromObject(modifiedObject);
var patch = new JsonPatchDocument();
FillPatchForObject(original, modified, patch, "/");
return patch;
}
static void FillPatchForObject(JObject orig, JObject mod, JsonPatchDocument patch, string path)
{
var origNames = orig.Properties().Select(x => x.Name).ToArray();
var modNames = mod.Properties().Select(x => x.Name).ToArray();
// Names removed in modified
foreach (var k in origNames.Except(modNames))
{
var prop = orig.Property(k);
patch.Remove(path + prop.Name);
}
// Names added in modified
foreach (var k in modNames.Except(origNames))
{
var prop = mod.Property(k);
patch.Add(path + prop.Name, prop.Value);
}
// Present in both
foreach (var k in origNames.Intersect(modNames))
{
var origProp = orig.Property(k);
var modProp = mod.Property(k);
if (origProp.Value.Type != modProp.Value.Type)
{
patch.Replace(path + modProp.Name, modProp.Value);
}
else if (!string.Equals(
origProp.Value.ToString(Newtonsoft.Json.Formatting.None),
modProp.Value.ToString(Newtonsoft.Json.Formatting.None)))
{
if (origProp.Value.Type == JTokenType.Object)
{
// Recurse into objects
FillPatchForObject(origProp.Value as JObject, modProp.Value as JObject, patch, path + modProp.Name +"/");
}
else
{
// Replace values directly
patch.Replace(path + modProp.Name, modProp.Value);
}
}
}
}
Usage:
var patch = CreatePatch(
new { Unchanged = new[] { 1, 2, 3, 4, 5 }, Changed = "1", Removed = "1" },
new { Unchanged = new[] { 1, 2, 3, 4, 5 }, Changed = "2", Added = new { x = "1" } });
// Result of JsonConvert.SerializeObject(patch)
[
{
"path": "/Removed",
"op": "remove"
},
{
"value": {
"x": "1"
},
"path": "/Added",
"op": "add"
},
{
"value": "2",
"path": "/Changed",
"op": "replace"
}
]
You could use my DiffAnalyzer. It's based on reflection and you can configure the depth you want to analyze.
https://github.com/rcarubbi/Carubbi.DiffAnalyzer
var before = new User { Id = 1, Name="foo"};
var after= new User { Id = 2, Name="bar"};
var analyzer = new DiffAnalyzer();
var results = analyzer.Compare(before, after);
You can use this
You can install using NuGet, see SimpleHelpers.ObjectDiffPatch at NuGet.org
PM> Install-Package SimpleHelpers.ObjectDiffPatch
Use:
StyleDetail styleNew = new StyleDetail() { Id = "12", Code = "first" };
StyleDetail styleOld = new StyleDetail() { Id = "23", Code = "second" };
var diff = ObjectDiffPatch.GenerateDiff (styleOld , styleNew );
// original properties values
Console.WriteLine (diff.OldValues.ToString());
// updated properties values
Console.WriteLine (diff.NewValues.ToString());
I am getting familiar with C# and Linq and appreciate any help. It should be easy for someone who works with it. I have a Json object that returns contact information. I also have a list of ids. I need to compare the list to the Json object and wherever the value in the list matches the userclientcode in the Json object, I need to extract the following information (only for the matches):
clienttaxonomy (if not empty)
fullname (if not empty)
[0]contactdata ( -> email if not null or empty)
[1]contactdata (-> address if not null or empty)
[2]contactdata (-> phone number if not null or empty)
First List
var fileContactIds = new List<string> { "5678765", "2135123", "12341234", "341234123", "12341234123", "2341234123", "341234123", "123412341", "13342354",
"12342341", "123412322", "163341234", "2345234115", "8967896", "75626234 };
JSON object returned with:
return JsonConvert.DeserializeObject<RelatedContacts>(json)?.list;
This is the Json object:
[![Json object][1]][1]
This is the Json string (unescaped):
{
"type": "com.kurtosys.api.userprofile.domain.RelatedContactList",
"list": [{
"objectlistid": 5678765,
"objectlisttypeid": 4567876,
"objectlistname": "ALL.National",
"clienttaxonomyid": 765677,
"clienttaxonomy": "National Wholesaler",
"order": 1,
"contacts": [{
"personid": 7654345678,
"fullname": "Person Jallo",
"userid": 876567,
"userclientcode": "341234123",
"contactdetails": [{
"contactid": 8765567,
"contacttypeid": 4565,
"contactdata": "person.contact#site.com"
}, {
"contactid": 876545678,
"contacttypeid": 4565,
"contactdata": "Baltimore,MD,21209,United States"
}, {
"contactid": 87654567,
"contacttypeid": 4584,
"contactdata": "410-413-2640"
}]
}]
}, {
"objectlistid": 765678,
"objectlisttypeid": 40400461,
"objectlistname": "RM.Internal",
"clienttaxonomyid": 7567898,
"clienttaxonomy": "Internal Regional Wholesaler",
"order": 2,
"contacts": [{
"personid": 56789876,
"fullname": "Jackson Man",
"userid": 876567,
"userclientcode": "1012275",
"contactdetails": [{
"contactid": 309598309,
"contacttypeid": 76546,
"contactdata": "mister.jackson##site.com.com"
}, {
"contactid": 876567,
"contacttypeid": 4581,
"contactdata": "Baltimore,MD,21209,United States"
}, {
"contactid": 876567,
"contacttypeid": 2342,
"contactdata": "123-413-2604"
}]
}]
}, {
"objectlistid": 309571364,
"objectlisttypeid": 40400461,
"objectlistname": "RM.External",
"clienttaxonomyid": 309580710,
"clienttaxonomy": "External Regional Wholesaler",
"order": 3,
"contacts": [{
"personid": 302736188,
"fullname": "Phal Sumi",
"userid": 303826019,
"userclientcode": "163341234",
"contactdetails": [{
"contactid": 309598253,
"contacttypeid": 2342,
"contactdata": "misters.emailas#site.com"
}, {
"contactid": 309611930,
"contacttypeid": 2342,
"contactdata": "Baltimore,MD,21209,United States"
}, {
"contactid": 34234132,
"contacttypeid": 3422,
"contactdata": "342-803-1793"
}]
}]
}]
}
How do I
1] Select using Linq and Lambdas and put in a list fullname, email, address etc from the deserialized object ?
2]compare with first list and only transfer those items where the userclientcode == the number in list A.
I have tried:
var query5 = relatedContact.Where(s => s.objectlistid == Convert.ToInt64(contacts.Select(t => t.id)))
var selected = relatedContact.Where(p => p.contacts
.Any(a => fileContactIds.Contains(p.contacts))
.ToList();
var query2 = relatedContact.Where(s => s.objectlistid == Convert.ToInt64(contacts.Select(t => t.id)))
.Select(s => new
{
Description = s.clienttaxonomy,
Fullname = s.contacts[0].fullname,
Email = s.contacts[0].contactdetails[0].contactdata,
Address = s.contacts[0].contactdetails[1].contactdata,
PhoneNumber = s.contacts[0].contactdetails[2].contactdata
});
But don't really know what I'm doing it seems. Any suggestions on how to get the required sections ? I think part of the reason is that the contactdata is a list.
Thanks all
You can create a classes for the desearlization of JSON Object like this
public class Rootobject
{
public string type { get; set; }
public List[] list { get; set; }
}
public class List
{
public int objectlistid { get; set; }
public int objectlisttypeid { get; set; }
public string objectlistname { get; set; }
public int clienttaxonomyid { get; set; }
public string clienttaxonomy { get; set; }
public int order { get; set; }
public Contact[] contacts { get; set; }
}
public class Contact
{
public long personid { get; set; }
public string fullname { get; set; }
public int userid { get; set; }
public string userclientcode { get; set; }
public Contactdetail[] contactdetails { get; set; }
}
public class Contactdetail
{
public int contactid { get; set; }
public int contacttypeid { get; set; }
public string contactdata { get; set; }
}
And then to extract the selected information we can also create a another class like
public class ExtractedInfo
{
public string ocClientTaxonomy { get; set; }
public string ocFullName { get; set; }
public CTDetails ocContactDetails { get; set; }
}
public class CTDetails
{
public string ocCTAddress { get; set; }
public string ocCTEmail { get; set; }
public string ocCTPhoneNumber { get; set; }
}
Now we have to find all the data from JSON
var fileContactIds = new List<string> { "5678765", "2135123", "12341234", "341234123", "12341234123", "2341234123", "341234123", "123412341", "13342354", "12342341", "123412322", "163341234", "2345234115", "8967896", "75626234" };
//Read JSON from txt file. You can do it by your way
string myjson = File.ReadAllText("Some.txt");
string ctphno, ctadd, ctemail, cltax, ctfullname;
List<ExtractedInfo> ei = new List<ExtractedInfo>();
CTDetails ctdtl = new CTDetails();
ExtractedInfo eiex = new ExtractedInfo();
//Deserialize the JSON string to Object.
Rootobject AllData = JsonConvert.DeserializeObject<Rootobject>(myjson);
//Finding all data in List Class
foreach(List lst in AllData.list)
{
cltax = lst.clienttaxonomy; // you can directly put eiex.ocClientTaxonomy = lst.clienttaxonomy;
foreach(Contact ct in lst.contacts)
{
//To check if value in the list matches the objectlistid in the Json object
if(fileContactIds.Contains(lst.objectlistid.ToString()))
{
ctfullname = ct.fullname; // you can directly put eiex.ocFullName = ct.fullname;
foreach(Contactdetail ctd in ct.contactdetails)
{
//Here we are trying to find the Match for Email.
if(Regex.IsMatch(ctd.contactdata, #"\A(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*#(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)\Z", RegexOptions.IgnoreCase))
{
ctemail = ctd.contactdata;
ctdtl.ocCTEmail = ctemail;
}
//Here We trying to find the match for Phone Number.
else if(Regex.IsMatch(ctd.contactdata, #"\(?\d{3}\)?-? *\d{3}-? *-?\d{4}", RegexOptions.IgnoreCase))
{
ctphno = ctd.contactdata;
ctdtl.ocCTPhoneNumber = ctphno;
}
//If NOthing matches than it might be address (Assumed)
else
{
ctadd = ctd.contactdata;
ctdtl.ocCTAddress = ctadd;
}
}
eiex.ocFullName = ctfullname;
}
}
eiex.ocClientTaxonomy = cltax;
eiex.ocContactDetails = ctdtl;
ei.Add(eiex);
}
Hope this helps and fit in your requirements.
I have project which uses Json data, I try deserialize a Json data like this:
[{"232":{"id":"232","reference":"022222","name":"Poire","content_title":"","content":"","pv_ttc":"230","picture_1":"","picture_2":"","picture_3":"","picture_4":"","picture_5":""}}]
If I correctly understand Json, at the beginning we have an index, then a sub-board with the name the reference the price etc.
Well, how to deserialize this text to object?
Knowing that I have my class as this:
public class productClass
{
public string id {get;set;}
public string reference { get; set; }
public string name { get; set; }
public string content_title{ get; set; }
public string content { get; set; }
public float pv_ttc{get;set;}
public string picture_1{get;set;}
public string picture_2{get;set;}
public string picture_3{get;set;}
public string picture_4{get;set;}
public string picture_5{get;set;}
public List<productClass> urlResult;
public productClass ( )
{
}
public productClass (string _id, string _reference, string _name, string _content_title, string _content, float _pv_ttc, string _picture_1, string _picture_2, string _picture_3, string _picture_4, string _picture_5)
{
id = _id;
reference = _reference;
name = _name;
content_title = _content_title;
content = _content;
pv_ttc = _pv_ttc;
picture_1 = _picture_1;
picture_2 = _picture_2;
picture_3 = _picture_3;
picture_4 = _picture_4;
picture_5 = _picture_5;
urlResult = new List<productClass> ( );
}
public void addUrl ( List<productClass> urlResult )
{
foreach ( productClass _url in urlResult )
{
urlResult.Add ( _url );
}
}
}
Thanks for help.
#sachou have you considered using JSON.Net? It is a really nice framework for .Net and you can easily de-serialize JSON strings into your C# objects. You can have a look in the documentation, but here is a simple example from the website:
Product product = new Product();
product.Name = "Apple";
product.ExpiryDate = new DateTime(2008, 12, 28);
product.Price = 3.99M;
product.Sizes = new string[] { "Small", "Medium", "Large" };
string output = JsonConvert.SerializeObject(product);
//{
// "Name": "Apple",
// "ExpiryDate": "2008-12-28T00:00:00",
// "Price": 3.99,
// "Sizes": [
// "Small",
// "Medium",
// "Large"
// ]
//}
Product deserializedProduct = JsonConvert.DeserializeObject<Product>(output);
I hope this helps.
I'd suggest you use a JSON Framework like
Newtonsoft JSON.NET
You can very easily serialize and deserialize JSON objects like this:
Product product = new Product();
product.Name = "Apple";
product.ExpiryDate = new DateTime(2008, 12, 28);
product.Price = 3.99M;
product.Sizes = new string[] { "Small", "Medium", "Large" };
string output = JsonConvert.SerializeObject(product);
//{
// "Name": "Apple",
// "ExpiryDate": "2008-12-28T00:00:00",
// "Price": 3.99,
// "Sizes": [
// "Small",
// "Medium",
// "Large"
// ]
//}
Product deserializedProduct = JsonConvert.DeserializeObject<Product>(output);
Take a closer look at Serializing/Deserializing JSON with JSON.net
Here is my example. I am using google map api as an example
I create following class corresponding to google maps
public class AddressComponent
{
public string long_name { get; set; }
public string short_name { get; set; }
public List<string> types { get; set; }
}
public class Result
{
public List<AddressComponent> address_components { get; set; }
public List<string> types { get; set; }
}
public class RootObject
{
public List<Result> results { get; set; }
public string status { get; set; }
}
Then I created this method
public string GetZipCodeBasedonCoordinates()
{
string zip = "";
string url2 = #"https://maps.googleapis.com/maps/api/geocode/json?latlng=37.423021, -122.083739&sensor=false";
System.Net.WebClient web = new System.Net.WebClient();
var result = web.DownloadString(url2);
RootObject root = JsonConvert.DeserializeObject<RootObject>(result);
var allresults = root.results;
foreach (var res in allresults)
{
foreach (var add in res.address_components)
{
var type = add.types;
if (type[0] == "postal_code")
{
zip = add.long_name;
}
}
}
return zip;
}
You can go here to see the resulting json that I have parsed
https://maps.googleapis.com/maps/api/geocode/json?latlng=37.423021,%20-122.083739&sensor=false
For more informations, see my deserialize's method :
public IEnumerator loadProducts (int cat)
{
List <int> catNoTri = new List<int> ();
catNoTri.Add (0);
gm.totalPriceItem.Clear();
isLoading = true;
WWW www = new WWW ( urlProduct );
yield return www;
Debug.Log(www.text);
string json = www.text.ToString ( );
IndexPrductClass myJson = JsonReader.Deserialize<IndexPrductClass> ( json );
foreach (productClass item in products)
{
for (int i = 0; i < products.Length; i++)
{
Debug.Log("product.productValue[i] = " + products[i].name);
}
if (firstLoad || gm.catId == 0)
{
Debug.Log ("here1");
nameProduct.Add (item.name);
Debug.Log("item.name = " + item.name);
idProduct.Add (item.id);
prixItem.Add (item.pv_ttc);
Debug.Log("item.pv_ttc = " + item.pv_ttc);
gm.totalPriceItem.Add (0);
gm.qte = new int [gm.totalPriceItem.Count];
descriptifProduct.Add (item.content);
Debug.Log(" item.content = " +item.content);
}
else if (!firstLoad)
{
Debug.Log ("here2");
nameProduct.Add (item.name);
idProduct.Add (item.id);
prixItem.Add (item.pv_ttc);
gm.totalPriceItem.Add (0);
gm.qte = new int [gm.totalPriceItem.Count];
descriptifProduct.Add (item.content);
}
}
gm.canLoad = true;
}
The fields are getting ignored. I'm successfully getting back a list of 2 objects, but none of the fields are populated. What am I doing wrong? (Unfortunately I don't have control over the json format. It arrives in exactly this structure.
using System.Web.Script.Serialization;
public void myMethod {
string myContent = #"
[
{
"my_object": {
"city": "city 1",
"myAge": 15
}
},
{
"my_object": {
"city": "city 2",
"myAge": 18
}
}
]";
JavaScriptSerializer serializer = new JavaScriptSerializer();
List<my_object> list = serializer.Deserialize<List<my_object>>(myContent);
}
public class json_content {
public string city { get; set; }
public int myAge { get; set; }
}
This code solves your problem:
public void myMethod()
{
string myContent = #"
[
{
""json_content"": {
""city"": ""city 1"",
""myAge"": 15
}
},
{
""json_content"": {
""city"": ""city 2"",
""myAge"": 18
}
}
]";
JavaScriptSerializer serializer = new JavaScriptSerializer();
List<wrapper> list = serializer.Deserialize<List<wrapper>>(myContent);
}
public class wrapper
{
public json_content json_content { get; set; }
}
public class json_content
{
public string city { get; set; }
public int myAge { get; set; }
}
You have list of objects with one property json_content in your JSON, but expect list directly containing json_content objects.
Most likely fix is to remove intermediate object from JSON (if you control it):
[
{
"city": "city 1",
"myAge": 15
},...
];
If you don't control JSON add outer class:
class JsonOuterContent
{
public JsonContent json_content;
}
List<JsonOuterContent> list = serializer
.Deserialize<List<JsonOuterContent>>(myContent);