Do we have an upper limit for the number of keys in a JSON array in javascript?

I am going to create a one-dimensional JSON array, I just want to be sure of its scalability. Is there an upper limit to the number of keys: pairs of values ​​that may be present in JSON?

+4
source share
1 answer

JSON is just a textual representation of JS objects, so the only limit is the amount of memory that supports it.

For real Javascript arrays, this depends on the software implementation, but by specification:

http://www.ecma-international.org/ecma-262/5.1/#sec-15.4

Each Array object has a length property, whose value is always equal to a non-negative integer less than 2 ^ 32

, (2 ^ 32) -1 4294967295, .

try {
   new Array(4294967295);
} catch(e){
   alert("Should be fine and not see this");
}

try {
  new Array(4294967296);
} catch(e){
  alert(e.name);
}
Hide result
+5

Source: https://habr.com/ru/post/1624949/


All Articles