Invalid replacer argument

An attempt has been made to invoke JSON.stringify with an argument that is not valid. The replacer argument must be a function or an array.

To correct this error

  • Change the replacer argument to a function or an array.


The code in this example causes a runtime error because memberfilter is an object instead of a function or array.

var contact = new Object();  
contact.firstname = "Jesper";  
contact.surname = "Aaberg"; = ["555-0100", "555-0120"];  
var memberfilter = new Object();  
// This line will cause a runtime error.  
var jsontext = JSON.stringify(contact, memberfilter, "\t");  

See also

JSON Object
JSON.parse Function
JavaScript Run-time Errors