Newtonsoft.json throwing error: Array was not a one-dimensional array.
Posted
by SIA
on Stack Overflow
See other posts from Stack Overflow
or by SIA
Published on 2010-04-20T21:58:22Z
Indexed on
2010/04/20
22:03 UTC
Read the original article
Hit count: 290
Hi everybody,
I am getting an error when trying to serialize an object products.
Product product = new Product();
product.Name = "Apple";
product.Expiry = new DateTime(2008, 12, 28);
product.Price = 3.99M;
product.Sizes = new string[3,2] { {"Small","40"}, {"Medium","44"}, {"Large","50"} };
string json = JsonConvert.SerializeObject(product);//this line is throwing an error
Array was not a one-dimensional array
Is there any way to serialize a two dimensional array with Newtonsoft.json
Thanks in Advance. SIA
© Stack Overflow or respective owner