Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

serializing data using json.net size limit?

I have developed an asp.net web application and initially serialized some data to a json string using the built in javascript serializer. This became problematic as I discovered later on that there was an issue about the amount of data I was able to serialize. I kept getting ""Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property". This was quickly fixed by using json.net to serialize /deserialize my data. This implied that either there is no preset maximum size when using json.net to serialize /deserialize or that there is a limit that's higher than that used by javascriptserializer.

My question is rather straightforward. Will I run into a similar issue in the future regarding size capacity when serializing /deserializing using json.net? i.e Is there a size limit when serializing data using json.net or can I assume there is no limit and my program should be fine as the size of the database increases? I asked this question on json.net's discussion forum bbut havent heard back. I'm hoping someone here knows the answer. Thanks in advance.

like image 623
John D Avatar asked Oct 07 '11 09:10

John D


People also ask

What is the max JSON length?

Property Value The maximum length of JSON strings. The default is 2097152 characters, which is equivalent to 4 MB of Unicode string data.

What is serializing in JSON?

JSON is a format that encodes objects in a string. Serialization means to convert an object into that string, and deserialization is its inverse operation (convert string -> object).

Does JSON serialize data?

Json namespace provides functionality for serializing to and deserializing from JavaScript Object Notation (JSON). Serialization is the process of converting the state of an object, that is, the values of its properties, into a form that can be stored or transmitted.

Why does JSON need to be serialized?

“Serializing” data is used to store and convert complex data types when writing and reading from memory. It is especially useful when sharing data between multiple systems which may not all share common data types.


1 Answers

There is no artificial limit.

Also internally Json.NET reads and writes over streams so there is no memory limit either.

like image 114
James Newton-King Avatar answered Oct 03 '22 20:10

James Newton-King