js_sys::JSON

Function stringify_with_replacer

source
pub fn stringify_with_replacer(
    obj: &JsValue,
    replacer: &JsValue,
) -> Result<JsString, JsValue>
Expand description

The JSON.stringify() method converts a JavaScript value to a JSON string.

The replacer argument is a function that alters the behavior of the stringification process, or an array of String and Number objects that serve as a whitelist for selecting/filtering the properties of the value object to be included in the JSON string. If this value is null or not provided, all properties of the object are included in the resulting JSON string.

MDN documentation