JSON.NET "System.OutOfMemoryException" when deserializing into a DataSet

Posted by Tiago on Stack Overflow See other posts from Stack Overflow or by Tiago
Published on 2014-06-11T02:06:10Z Indexed on 2014/06/11 3:25 UTC
Read the original article Hit count: 3361

Filed under:
|
|

Very new to C# and JSON. I have been struggling with this problem for about a day and can't figure it out.

JSONLint states both JSON strings are valid.

Trying to deserialize the following

{"items":[{"id":"1122267","quantity":"1","bundle":"1"}],"seconds_ago":"1"}

throws the exception

An unhandled exception of type 'System.OutOfMemoryException' occurred in Newtonsoft.Json.dll

If I try

{"items":[{"id":"1122267","quantity":"1","bundle":"1"}]} 

it works.

I'm reading the JSON string from a textbox and then deserializing using the following

string json = textBox1.Text;
DataSet dataSet = JsonConvert.DeserializeObject<DataSet>(json);

© Stack Overflow or respective owner

Related posts about c#

Related posts about JSON