← All procedures

client.parseJson

Parse JSON string (optionally with procedure ref support)

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

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","parseJson"], { json: "<json>" });
console.log(JSON.stringify(result));

As data, in a program

{ "$proc": ["client", "parseJson"], "input": { "json": "<json>" } }

Input

FieldTypeRequired
jsonstringyes
parseProceduresbooleanno

Output

The schema does not list fields (any).

JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "json": {
        "type": "string",
        "description": "JSON string to parse"
      },
      "parseProcedures": {
        "description": "Whether to parse procedure refs ($proc syntax)",
        "type": "boolean"
      }
    },
    "required": [
      "json"
    ]
  },
  "output": {
    "description": "The parsed JSON value"
  }
}