Commands
JSON
Documentation for the /json command to manipulate JSON strings
/json
Command
The /json
command provides tools to manipulate JSON strings.
Available Subcommands
/json beautify
Formats and beautifies a JSON string by adding indentation and line breaks.
Usage
Options
Option | Description | Required | Platform |
---|---|---|---|
input | The JSON string to format | Yes | Discord (parameter), Slack (directly after action) |
Example
/json validate
Checks if a JSON string is valid and well-formed.
Usage
Options
Option | Description | Required | Platform |
---|---|---|---|
input | The JSON string to validate | Yes | Discord (parameter), Slack (directly after action) |
Example
/json clean
Cleans a JSON string by removing unwanted characters.
Usage
Options
Option | Description | Required | Platform |
---|---|---|---|
input | The JSON string to clean | Yes | Discord (parameter), Slack (directly after action) |
Example
Platform-Specific Implementation
Discord Implementation
- Commands use Discord’s subcommand system with named parameters (e.g.,
input:
) - Responses appear as embeds in the channel where the command is invoked
- Formatting is preserved in code blocks with syntax highlighting
- Large JSON outputs may be truncated with an indicator
Slack Implementation
- Commands use a simpler format where input follows directly after the action
- Responses are shown with formatted blocks showing the input and output
- For very large JSON, output may be uploaded as a file attachment
- The command supports help functionality by simply typing
/json
Use Cases
- Format JSON to make it more readable
- Verify the validity of a JSON string
- Clean poorly formatted JSON or remove escape characters
- Share clean JSON code in Discord or Slack conversations
- Extract JSON from logs by cleaning unwanted characters
Notes
- Very long JSON strings may be truncated in the display or provided as file attachments
- The command works with nested JSON objects and arrays