JSON Modifier for Openclaw

A specialized utility for applying RFC 6902 compliant JSON patches to files safely without rewriting the entire document.

wanng-ide
v1.0.0
Feb 16, 2026
0
1.7k
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install json-modifier

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install json-modifier using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is JSON Modifier?

The JSON Modifier is a high-precision tool designed to manipulate JSON data structures using the industry-standard RFC 6902 format. Unlike traditional text-editing methods that rely on brittle regex or complete file overwrites, this skill allows for granular modifications including adding, removing, replacing, moving, and copying specific data nodes. It is an essential component for developers building complex Openclaw Skills that require reliable configuration management.

By treating JSON as a structured tree rather than raw text, the JSON Modifier ensures that data integrity is maintained throughout the editing process. It is particularly effective for automated environments where multiple agents or processes need to update shared configuration files, package manifests, or state records without causing merge conflicts or syntax errors.

JSON Modifier Use Cases

  • Updating version numbers or dependencies in package.json files dynamically.
  • Modifying environment-specific configuration keys in large JSON manifests.
  • Managing persistent state and memory files for agents using Openclaw Skills.
  • Appending items to nested arrays in complex data structures without manual intervention.
  • Validating existing data points using the RFC 6902 test operation before applying updates.

How JSON Modifier Works

  1. The user specifies a target JSON file and provides a patch defined in the RFC 6902 array format.
  2. The skill parses the target file and validates the proposed operations against the current document structure.
  3. The specified transformations (add, remove, replace, etc.) are applied to the in-memory representation of the data.
  4. To prevent data loss, the skill performs an atomic write operation by saving to a temporary file before renaming it to the original filename.
  5. The skill automatically detects and preserves the original indentation of the file to maintain project coding standards.

JSON Modifier Setup

To use this utility within your Openclaw Skills environment, you can invoke the script directly via Node.js:

# Basic syntax to modify a file in place
node skills/json-modifier/index.js --file path/to/config.json --patch '[{"op": "replace", "path": "/key", "value": "new_value"}]'

# Using a dedicated patch file for complex updates
node skills/json-modifier/index.js --file input.json --patch-file patches/update.json --out output.json

JSON Modifier Data Schema & Taxonomy

The JSON Modifier utilizes the RFC 6902 standard for defining patches. Each patch is an array of objects with the following structure:

Attribute Type Description
op String The operation to perform: add, remove, replace, move, copy, or test.
path String A JSON Pointer (RFC 6901) string representing the target location.
value Mixed The value to be used (required for add, replace, and test operations).
from String The source location for move or copy operations.

JSON Modifier Advanced Features

  • Full RFC 6902 Support: Implements all six standard JSON patch operations for maximum flexibility.
  • Atomic Writes: Protects against file corruption during system failures by using temporary file swapping.
  • Format Preservation: Automatically maintains the existing indentation (defaulting to 2 spaces) so the resulting Openclaw Skills code remains readable.
  • Validation Logic: Pre-checks the document to ensure the path exists before attempting a replace or remove operation, preventing runtime errors.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*