Home » Php » php – JSON limitation?

php – JSON limitation?

Posted by: admin July 12, 2020 Leave a comment

Questions:

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?

EDIT:
My client is JavaScript and my server PHP.

Thank you.

How to&Answers:

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.

Answer:

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).

Answer:

Similar question

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.)

Answer:

HTTP POST requests have no (reasonable) size limitations.

However, if you’re posting more than 100MB of data, it’s unlikely to work reliably.

Answer:

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.

More : http://blogs.oracle.com/bblfish/entry/the_limitations_of_json