You can use JSON.stringify
with a replacer
like:
JSON.stringify({
color: 'red',
doSomething: function (arg) {
alert('Do someting called with ' + arg);
}
}, function(key, val) {
return (typeof val === 'function') ? '' + val : val;
});
More Related Contents:
- Stringify (convert to JSON) a JavaScript object with circular reference
- How to stringify event object?
- Convert form data to JavaScript object with jQuery
- Serializing to JSON in jQuery [duplicate]
- Serializing object that contains cyclic object value
- How to serialize DOM node to JSON even if there are circular references?
- Convert javascript object or array to json for ajax data
- JSON.stringify deep objects
- JSON.stringify output to div in pretty print way
- Multiple arguments vs. options object
- Re-associating an object with its class after deserialization in Node.js
- JSON.stringify converting Infinity to null
- How to restore circular references (e.g. “$id”) from Json.NET-serialized JSON?
- Issue with JSON.stringify adding a extra \ and “” to my Json object
- Why does JSON.stringify return empty object notation “{}” for an object that seems to have properties?
- Why does JSON.stringify not serialize non-enumerable properties?
- Convert JSON to array in Javascript
- How to use JSON from instagram API?
- Pass an extra argument to a callback function
- Traverse all the Nodes of a JSON Object Tree with JavaScript
- Is it not possible to stringify an Error using JSON.stringify?
- Parsing JSON giving “unexpected token o” error [duplicate]
- How to get object length [duplicate]
- How to filter JSON Data in JavaScript or jQuery?
- JavaScript: clone a function
- How to convert the following table to JSON with javascript?
- Why can I not use `new` with an arrow function in JavaScript/ES6?
- how to change the headers for angularjs $http.jsonp
- Make XmlHttpRequest POST using JSON [duplicate]
- JSON Parse File Path