JSON File Operations Skill
Generic JSON file operations with JSON path notation support for field-level access.
What This Skill Provides
- Read, write, and update any JSON file
- Field-level access using JSON path notation
- Array and object manipulation
- Atomic writes with validation
- Works with any JSON file (including configuration directories)
When to Activate This Skill
Activate this skill when:
- Reading or writing JSON files
- Performing structured updates to JSON content
- Accessing specific fields within JSON files
- Adding or removing entries from JSON arrays/objects
Workflow: JSON File Operations
Pattern: Command Chain Execution
Perform read, write, and update operations on JSON files.
Parameters
- file_path (required): Path to JSON file
- operation (required): One of
read, read-field, write, update-field, add-entry, remove-entry
- field (optional): JSON path for field operations (e.g.,
parent.child.field)
- value (optional): Value for write/update operations (JSON string)
Step 1: Execute Operation
python3 .plan/execute-script.py plan-marshall:tools-json-ops:{operation} {file_path} [--field {field}] [--value '{value}']
Step 2: Process Result
Parse JSON output:
success: true - Return result value
success: false - Report error message
Operations Reference
| Operation |
Description |
Required Params |
read |
Read entire file |
file_path |
read-field |
Read specific field |
file_path, field |
write |
Write entire content |
file_path, value |
update-field |
Update specific field |
file_path, field, value |
add-entry |
Add to array/object |
file_path, field, value |
remove-entry |
Remove from array/object |
file_path, field, value |
Example Usage
# Read entire file
python3 .plan/execute-script.py plan-marshall:tools-json-ops:manage-json-file read config.json
# Read specific field
python3 .plan/execute-script.py plan-marshall:tools-json-ops:manage-json-file read-field config.json --field "database.host"
# Update field
python3 .plan/execute-script.py plan-marshall:tools-json-ops:manage-json-file update-field config.json --field "database.port" --value '5432'
# Add to array
python3 .plan/execute-script.py plan-marshall:tools-json-ops:manage-json-file add-entry config.json --field "servers" --value '"new-server"'
# Remove from array
python3 .plan/execute-script.py plan-marshall:tools-json-ops:manage-json-file remove-entry config.json --field "servers" --value '"old-server"'
JSON Path Notation
Use dot notation for JSON paths:
| Path |
Description |
field |
Top-level field |
parent.child |
Nested object |
parent.child.grandchild |
Deep nested field |
array[0] |
First array element |
array[-1] |
Last array element |
Special Characters
- Use quotes for keys with special characters:
parent."my-key".field
- Array indices use bracket notation:
[0], [-1]
Scripts
| Script |
Notation |
| manage-json-file |
plan-marshall:tools-json-ops |
Script characteristics:
- Uses Python stdlib only (json, argparse, pathlib)
- Outputs JSON to stdout
- Exit code 0 for success, 1 for errors
- Supports
--help flag
Integration Points
With Scripts Library
- Scripts are discovered via scripts-library.toon
- Use portable notation from Scripts table above
With manage-memories Skill
- Provides low-level JSON operations used by memory layer
With manage-run-configuration Skill
- Provides low-level JSON operations for run configuration
1---2name: tools-json-ops3description: Generic JSON file CRUD operations with path notation support4---5
6# JSON File Operations Skill
7
8Generic JSON file operations with JSON path notation support for field-level access.
9
10## What This Skill Provides
11
12- Read, write, and update any JSON file
13- Field-level access using JSON path notation
14- Array and object manipulation
15- Atomic writes with validation
16- Works with any JSON file (including configuration directories)
17
18## When to Activate This Skill
19
20Activate this skill when:
21- Reading or writing JSON files
22- Performing structured updates to JSON content
23- Accessing specific fields within JSON files
24- Adding or removing entries from JSON arrays/objects
25
26---
27
28## Workflow: JSON File Operations
29
30**Pattern**: Command Chain Execution
31
32Perform read, write, and update operations on JSON files.
33
34### Parameters
35
36- **file_path** (required): Path to JSON file
37- **operation** (required): One of `read`, `read-field`, `write`, `update-field`, `add-entry`, `remove-entry`
38- **field** (optional): JSON path for field operations (e.g., `parent.child.field`)
39- **value** (optional): Value for write/update operations (JSON string)
40
41### Step 1: Execute Operation
42
43```bash
44python3 .plan/execute-script.py plan-marshall:tools-json-ops:{operation} {file_path} [--field {field}] [--value '{value}']
45```
46
47### Step 2: Process Result
48
49Parse JSON output:
50- `success: true` - Return result value
51- `success: false` - Report error message
52
53### Operations Reference
54
55| Operation | Description | Required Params |
56|-----------|-------------|-----------------|
57| `read` | Read entire file | file_path |
58| `read-field` | Read specific field | file_path, field |
59| `write` | Write entire content | file_path, value |
60| `update-field` | Update specific field | file_path, field, value |
61| `add-entry` | Add to array/object | file_path, field, value |
62| `remove-entry` | Remove from array/object | file_path, field, value |
63
64### Example Usage
65
66```bash
67# Read entire file
68python3 .plan/execute-script.py plan-marshall:tools-json-ops:manage-json-file read config.json
69
70# Read specific field
71python3 .plan/execute-script.py plan-marshall:tools-json-ops:manage-json-file read-field config.json --field "database.host"
72
73# Update field
74python3 .plan/execute-script.py plan-marshall:tools-json-ops:manage-json-file update-field config.json --field "database.port" --value '5432'
75
76# Add to array
77python3 .plan/execute-script.py plan-marshall:tools-json-ops:manage-json-file add-entry config.json --field "servers" --value '"new-server"'
78
79# Remove from array
80python3 .plan/execute-script.py plan-marshall:tools-json-ops:manage-json-file remove-entry config.json --field "servers" --value '"old-server"'
81```
82
83---
84
85## JSON Path Notation
86
87Use dot notation for JSON paths:
88
89| Path | Description |
90|------|-------------|
91| `field` | Top-level field |
92| `parent.child` | Nested object |
93| `parent.child.grandchild` | Deep nested field |
94| `array[0]` | First array element |
95| `array[-1]` | Last array element |
96
97### Special Characters
98
99- Use quotes for keys with special characters: `parent."my-key".field`
100- Array indices use bracket notation: `[0]`, `[-1]`
101
102---
103
104## Scripts
105
106| Script | Notation |
107|--------|----------|
108| manage-json-file | `plan-marshall:tools-json-ops` |
109
110Script characteristics:
111- Uses Python stdlib only (json, argparse, pathlib)
112- Outputs JSON to stdout
113- Exit code 0 for success, 1 for errors
114- Supports `--help` flag
115
116---
117
118## Integration Points
119
120### With Scripts Library
121- Scripts are discovered via scripts-library.toon
122- Use portable notation from Scripts table above
123
124### With manage-memories Skill
125- Provides low-level JSON operations used by memory layer
126
127### With manage-run-configuration Skill
128- Provides low-level JSON operations for run configuration