wasm-bindgen/api/js_sys/JSON/fn.stringify_with_replacer_and_space.html

16 lines
5.1 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `stringify_with_replacer_and_space` fn in crate `js_sys`."><meta name="keywords" content="rust, rustlang, rust-lang, stringify_with_replacer_and_space"><title>js_sys::JSON::stringify_with_replacer_and_space - Rust</title><link rel="stylesheet" type="text/css" href="../../normalize.css"><link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../dark.css"><link rel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><script src="../../storage.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="shortcut icon" href="../../favicon.ico"><style type="text/css">#crate-search{background-image:url("../../down-arrow.svg");}</style></head><body class="rustdoc fn"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../../js_sys/index.html'><div class='logo-container'><img src='../../rust-logo.png' alt='logo'></div></a><div class="sidebar-elems"><p class='location'><a href='../index.html'>js_sys</a>::<wbr><a href='index.html'>JSON</a></p><script>window.sidebarCurrent = {name: 'stringify_with_replacer_and_space', ty: 'fn', relpath: ''};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span><a class='srclink' href='../../src/js_sys/lib.rs.html#3603' title='goto source code'>[src]</a></span><span class='in-band'>Function <a href='../index.html'>js_sys</a>::<wbr><a href='index.html'>JSON</a>::<wbr><a class="fn" href=''>stringify_with_replacer_and_space</a></span></h1><pre class='rust fn'>pub fn stringify_with_replacer_and_space(<br>&nbsp;&nbsp;&nbsp;&nbsp;obj: &amp;<a class="struct" href="../../wasm_bindgen/struct.JsValue.html" title="struct wasm_bindgen::JsValue">JsValue</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;replacer: &amp;<a class="struct" href="../../wasm_bindgen/struct.JsValue.html" title="struct wasm_bindgen::JsValue">JsValue</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;space: &amp;<a class="struct" href="../../wasm_bindgen/struct.JsValue.html" title="struct wasm_bindgen::JsValue">JsValue</a><br>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="../../js_sys/struct.JsString.html" title="struct js_sys::JsString">JsString</a>, <a class="struct" href="../../wasm_bindgen/struct.JsValue.html" title="struct wasm_bindgen::JsValue">JsValue</a>&gt;</pre><div class='docblock'><p>The <code>JSON.stringify()</code> method converts a JavaScript value to a JSON string.</p>
<p>The <code>replacer</code> 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.</p>
<p>The <code>space</code> argument is a String or Number object that's used to insert white space into
the output JSON string for readability purposes. If this is a Number, it
indicates the number of space characters to use as white space; this number
is capped at 10 (if it is greater, the value is just 10). Values less than
1 indicate that no space should be used. If this is a String, the string
(or the first 10 characters of the string, if it's longer than that) is
used as white space. If this parameter is not provided (or is null), no
white space is used.</p>
<p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify">MDN documentation</a></p>
</div></section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../../";window.currentCrate = "js_sys";</script><script src="../../main.js"></script><script defer src="../../search-index.js"></script></body></html>