I would like to know if JSON with AJAX has a limitation to the amount of data an outgoing and returning parameter can carry?
I would like to be able to send and return from the server a file with 10,000 lines, as a string. How should I achieve this task? Will a single parameter will be able to hand this?
you should break up the string into bits and do multiple ajax requests until string is complete. Keep appending the string bits temporarily to a file and then put the file contents inside of your database once the requests are complete.
JSON does not inherently have a limit as to the amount of data it can transmit or a limit on its recursion depth. This depends on your application server.
If you’re using JSONSerialization with C#, the limit on the amount of data is set to pretty low. You can overwrite that by putting the following code snippet in your Web.config.
<system.web.extensions> <scripting> <webServices> <jsonSerialization maxJsonLength="2147483644"></jsonSerialization> </webServices> </scripting> </system.web.extensions>
You probably DON’T want to be sending around 10 000 lines via AJAX if you can avoid it (break it up into smaller requests or use paging).
JSON is similar to other data formats like XML – if you need to transmit more data, you just send more data. There’s no inherent size limitation to the overall JSON request itself. Any limitation would be set by the server parsing the JSON request. (For instance, ASP.NET has the “MaxJsonLength” property of the serializer.)
HTTP POST requests have no (reasonable) size limitations.
However, if you’re posting more than 100MB of data, it’s unlikely to work reliably.
I think the biggest weakness of Json is the semantics.
Otherwise there is no limitations if you are using HttpPost. But of course for better user experience, keep it simple and less.