Copy link to clipboard
Copied
Hi
I'm loading this test object from an external txt file into CS6 using JSON.parse:
{"TEST":[{"Key1":"Val1","Key2":"Val2","Key3":"Val3"},{"Key1":"Val1","Key2":"Val2","Key3":"Val3"}]}
It works fine, except if I have over about 2500 copies of {"Key1":"Val1","Key2":"Val2","Key3":"Val3"} in the TEST array, then Error #1132: Invalid JSON parse input is triggered.
Anyone know of a datasize limit when parsing JSON?
Copy link to clipboard
Copied
Very large. As mentioned in your other thread, here's 2 million additions of your previous example.
import flash.utils.getTimer;
// start time
var startTime:int = getTimer();
// make ridiculos 1 MILLION length object
var str:String = '{"songs":[{"Title":"Bad Influence","Artist":"Pink","DiscID":"EMI8988"}';
for (var i:int = 0; i < 2000000; i++)
{
str += ',{"Title":"Bad Influence","Artist":"Pink","DiscID":"EMI8988"}';
}
str += ']}';
var myData:Object = JSON.parse(str);
trace(myData.songs[1999999].Title);
trace("Total time: " + (getTimer() - startTime) + "ms");
Trace:
Bad Influence
Total time: 13680ms
Anything even nearing 1 million should be using a database, and a good database, on a server, let alone the 2 million tested on a slow old laptop with 4GB RAM.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now