Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

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";
contact.phone = ["555-0100", "555-0120"];

var memberfilter = new Object();

// This line will cause a runtime error.
var jsontext = JSON.stringify(contact, memberfilter, "\t");
© 2015 Microsoft