javascript - How many properties can a json object have at most?
PHP中文网
PHP中文网 2017-05-19 10:39:25
0
4
632

I have a question. If there are hundreds of thousands of attributes in my json object, will there be any problems with json?

PHP中文网
PHP中文网

认证0级讲师

reply all(4)
左手右手慢动作

js should have no restrictions on it, but the performance of the computer is limited.
I actually tested it:

var obj={};
for(var i=0;i<80000000;i++){
   obj[i]=i;
   if(i%1000==0){
          console.log(i);
       }
}    

My computer will crash when it reaches over 70 million.
The more complex the keys and values ​​stored in the object, the smaller the number that can be accommodated.

But in actual application, you definitely can’t do it like this!

左手右手慢动作

... Then why do you use Json? It's hard to throw the data into the database and then use the backend to write a program to read the database. .

迷茫

Hundreds of thousands of properties. . . JSON itself does not have any restrictions on the number of attributes, but js processing may be very slow, or a single request may not be able to be accommodated through http transmission. . .

滿天的星座

The question is why do you put hundreds of thousands of attributes in a JSON. .

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template