← All procedures

client.stringifyJson

Stringify value to JSON (with procedure ref support)

browsernot registered
Package
@procedures/client · README
Path
["client","stringifyJson"]
CLI
Not a mark command: it is not in the default registry.
As data
{"$proc":["client","stringifyJson"],"input":{}}
Tags
core, meta, raw-input

Try it in the Composer →

Use it

In TypeScript

import { Client, LocalTransport, PROCEDURE_REGISTRY, allCoreProcedures } from "@procedures/client";

for (const procedure of allCoreProcedures) {
  if (!PROCEDURE_REGISTRY.has(procedure.path)) PROCEDURE_REGISTRY.register(procedure);
}

const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["client","stringifyJson"], {});
console.log(JSON.stringify(result));

As data, in a program

{ "$proc": ["client", "stringifyJson"], "input": {} }

Input

FieldTypeRequired
valueunknownno
prettybooleanno
indentstring | numberno

Output

The schema does not list fields (string).

JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "value": {
        "description": "Value to stringify"
      },
      "pretty": {
        "description": "Pretty print with indentation",
        "type": "boolean"
      },
      "indent": {
        "description": "Custom indentation (number of spaces or string)",
        "type": [
          "number",
          "string"
        ]
      }
    }
  },
  "output": {
    "type": "string",
    "description": "The JSON text"
  }
}