Overview
The JSON tool provides operations for parsing, querying, validating, and transforming JSON data with JSONPath-like query support.json
Parse, query, and transform JSON data. Supports JSONPath-like queries for extracting values from complex structures. Input Parametersstring
required
The JSON operation to perform. Must be one of:
parse, query, stringify, validaterequired
JSON input data. Pass a string for parse, or any JSON value (object, array, string, number, boolean, null) otherwise.
string
JSONPath-like path for query operation (e.g.,
foo.bar[0].baz)Operations
parse
Parse a JSON string into a structured value. Inputstring
required
JSON string to parse
InvalidParameters:datais not a string or contains invalid JSON
stringify
Convert a JSON value to a pretty-printed string. Inputstring
required
JSON string representing the value to stringify
query
Extract a value from JSON using a JSONPath-like path. Inputstring
required
JSON string to query
string
required
Path to the value (e.g.,
user.name, items[0].id, config.api.endpoints[2].url)- Dot notation for object fields:
foo.bar.baz - Array indexing with brackets:
items[0],list[5] - Combined:
user.orders[2].items[0].name
InvalidParameters: Missingpathparameter or invalid array indexExecutionFailed: Field not found or array index out of bounds
validate
Check if a string contains valid JSON. Inputstring
required
String to validate as JSON
boolean
True if string is valid JSON, false otherwise
Examples
Extract Nested Value
"localhost"
Access Array Element
"Bob"
Parse API Response
Format JSON
Use Cases
Extract Configuration Values
Parse config files and extract specific settings:Validate External Data
Check if external input is valid JSON before processing:Navigate API Responses
Extract values from nested API responses:Pretty Print JSON
Format compact JSON for readability:Error Handling
- Unknown operation
datais not a string when required- Invalid JSON in
datastring - Missing
pathfor query operation - Invalid array index in path
- Field not found at specified path
- Array index out of bounds
- Failed to stringify JSON
Technical Details
Sanitization
No sanitization required - internal tool with no external data access.Approval
No approval required - safe internal operation.Path Resolution
Paths are resolved left-to-right:- Split on
.to get segments - For each segment, check for array indexing
[n] - Navigate to field, then to array index if present
- Return final value
OpenAI Compatibility
Thedata parameter is intentionally freeform (no type constraint) for OpenAI compatibility. OpenAI rejects union types containing array unless items is also specified.