Skip to main content
Module

x/denops_std/function/mod.ts>json_encode

📚 Standard module for denops.vim
Go to Latest
function json_encode
import { json_encode } from "https://deno.land/x/denops_std@v3.10.1/function/mod.ts";

Encode {expr} as JSON and return this as a string. The encoding is specified in: https://tools.ietf.org/html/rfc7159.html Vim values are converted as follows: |Number| decimal number |Float| floating point number Float nan "NaN" Float inf "Infinity" Float -inf "-Infinity" |String| in double quotes (possibly null) |Funcref| not possible, error |List| as an array (possibly null); when used recursively: [] |Dict| as an object (possibly null); when used recursively: {} |Blob| as an array of the individual bytes v:false "false" v:true "true" v:none "null" v:null "null" Note that NaN and Infinity are passed on as values. This is missing in the JSON standard, but several implementations do allow it. If not then you will get an error. Can also be used as a |method|: GetObject()->json_encode()

Parameters

denops: Denops
expr: unknown

Returns

Promise<unknown>