What is the maximum length of a field name in JSON?
For example, in the following json document
{
"myfield":"value"
}
can I make "myfield" as long as 100 characters?
JSON is a format like XML and it doesn't have any limits. However, the JSON parser may impose a limit on the size of the document as a whole:
in ASP.Net, there's "MaxJsonLength". The default is 2097152 characters, which is equivalent to 4 MB of Unicode string data.
in PHP, there's no max length for a JSON string. PHP will fail parsing a JSON string if it reaches the PHP memory_limit or if the JSON string posted is larger than the PHP post_max_size.
etc.
A hundred characters won't cause a problem. If you reach 4MB of data, you should probably look into reducing the size of the JSON document or finding a workaround.
EDIT
To clarify my point, there's no limit for a name or value inside a JSON document. If there's any limit, it is applied to the size of the JSON document as a whole.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With