I am getting RangeError during serialization of Navigator object.
What could be the reason?
JSON.stringify(navigator);
RangeError: Maximum call stack size exceeded
Browser: Chrome
I am getting RangeError during serialization of Navigator object.
What could be the reason?
JSON.stringify(navigator);
RangeError: Maximum call stack size exceeded
Browser: Chrome
Share Improve this question edited Jan 12, 2013 at 5:45 P K asked Jan 12, 2013 at 5:38 P KP K 10.2k13 gold badges56 silver badges99 bronze badges 2- You need to show what is inside the navigator object. – StilesCrisis Commented Jan 12, 2013 at 5:42
- 1 Basically, your navigator object is too big. – Alex W Commented Jan 12, 2013 at 5:44
3 Answers
Reset to default 4That's because, as the error message says, the navigator
object is too big.
You can use dystroy's modified JSON function like this:
var navJSON = JSON.pruned(navigator);
The object returned is pretty huge, but it's almost certain that it isn't pletely correct. If you want to transfer data about the navigator
object using JSON, you should send those properties only, not the entire object.
Why dont you copy the specific values you are interested over to a new object and then serialize that instead?
Maybe its finding a property that results in an endless loop.
Maybe navigator object contain the self-link. You should copy navigator in other object and delete big links on them.