OpenClawSkills
GitHub

JSON Validator

Community

Validate and format JSON strings directly in the chat.

Installation

Save as `json.js`.

Source Code

JavaScript
Tutorial.terminal

// json.js
// Usage: Pass a JSON string as an argument

module.exports = async function(context) {
    const input = context.args.join(' ');
    try {
        const obj = JSON.parse(input);
        return {
            valid: true,
            formatted: JSON.stringify(obj, null, 2)
        };
    } catch (e) {
        return {
            valid: false,
            error: e.message
        };
    }
};

Live Preview

● Live Demo
Agent Session
Starting session...

How to use

  • Ensure you have the necessary dependencies installed (if any).
  • Place the file in your OpenClaw skills folder (e.g., ~/.openclaw/skills/).
  • Restart your agent or reload configuration.
  • Invoke it using the filename (without extension) as the tool name, or through natural language if the description is clear.