Skip to main content

value_to_json_string

Function value_to_json_string 

Source
pub(crate) fn value_to_json_string(
    it: &mut Interp,
    v: &Value,
    indent: &str,
    depth: usize,
    key_filter: Option<&Vec<String>>,
    replacer_fn: Option<&Value>,
) -> Result<Option<String>, Value>
Expand description

Value を JSON 文字列へ(undefined/関数は省略)。indent が空でなければ depth 段の インデント付き整形出力にする(JSON.stringify(v, null, 2) 等)。key_filterSome なら(replacer が配列指定のとき)オブジェクトのキーをそれで絞り込む (配列要素自体には適用しない。仕様どおり)。replacer_fnSome なら各値を replacer_fn(key, value)this はプロパティの持ち主)で差し替えてから直列化する。