Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/nearai/ironclaw/llms.txt

Use this file to discover all available pages before exploring further.

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 Parameters
operation
string
required
The JSON operation to perform. Must be one of: parse, query, stringify, validate
data
required
JSON input data. Pass a string for parse, or any JSON value (object, array, string, number, boolean, null) otherwise.
path
string
JSONPath-like path for query operation (e.g., foo.bar[0].baz)

Operations

parse

Parse a JSON string into a structured value. Input
data
string
required
JSON string to parse
Output Returns the parsed JSON value (object, array, string, number, boolean, or null). Example
{
  "operation": "parse",
  "data": "{\"name\": \"Alice\", \"age\": 30}"
}
Response
{
  "name": "Alice",
  "age": 30
}
Error Conditions
  • InvalidParameters: data is not a string or contains invalid JSON

stringify

Convert a JSON value to a pretty-printed string. Input
data
string
required
JSON string representing the value to stringify
Output Returns a JSON string (pretty-printed with indentation). Example
{
  "operation": "stringify",
  "data": "{\"name\":\"Alice\",\"age\":30}"
}
Response
"{\n  \"name\": \"Alice\",\n  \"age\": 30\n}"

query

Extract a value from JSON using a JSONPath-like path. Input
data
string
required
JSON string to query
path
string
required
Path to the value (e.g., user.name, items[0].id, config.api.endpoints[2].url)
Output Returns the value at the specified path. Example
{
  "operation": "query",
  "data": "{\"user\": {\"name\": \"Alice\", \"emails\": [\"a@example.com\", \"b@example.com\"]}}",
  "path": "user.emails[0]"
}
Response
"a@example.com"
Path Syntax
  • Dot notation for object fields: foo.bar.baz
  • Array indexing with brackets: items[0], list[5]
  • Combined: user.orders[2].items[0].name
Error Conditions
  • InvalidParameters: Missing path parameter or invalid array index
  • ExecutionFailed: Field not found or array index out of bounds

validate

Check if a string contains valid JSON. Input
data
string
required
String to validate as JSON
Output
valid
boolean
True if string is valid JSON, false otherwise
Example
{
  "operation": "validate",
  "data": "{\"valid\": true}"
}
Response
{
  "valid": true
}
Invalid JSON Example
{
  "operation": "validate",
  "data": "{not valid json}"
}
Response
{
  "valid": false
}

Examples

Extract Nested Value

{
  "operation": "query",
  "data": "{\"config\": {\"database\": {\"host\": \"localhost\", \"port\": 5432}}}",
  "path": "config.database.host"
}
Response: "localhost"

Access Array Element

{
  "operation": "query",
  "data": "{\"users\": [{\"name\": \"Alice\"}, {\"name\": \"Bob\"}]}",
  "path": "users[1].name"
}
Response: "Bob"

Parse API Response

{
  "operation": "parse",
  "data": "{\"status\": 200, \"data\": {\"id\": 123, \"name\": \"Product\"}}"
}
Response:
{
  "status": 200,
  "data": {
    "id": 123,
    "name": "Product"
  }
}

Format JSON

{
  "operation": "stringify",
  "data": "{\"compact\":true,\"version\":1}"
}
Response:
"{\n  \"compact\": true,\n  \"version\": 1\n}"

Use Cases

Extract Configuration Values

Parse config files and extract specific settings:
{
  "operation": "query",
  "data": "...",
  "path": "services.api.port"
}

Validate External Data

Check if external input is valid JSON before processing:
{
  "operation": "validate",
  "data": "<user-input>"
}
Extract values from nested API responses:
{
  "operation": "query",
  "data": "<api-response>",
  "path": "data.results[0].id"
}

Pretty Print JSON

Format compact JSON for readability:
{
  "operation": "stringify",
  "data": "{\"a\":1,\"b\":2}"
}

Error Handling

InvalidParameters
  • Unknown operation
  • data is not a string when required
  • Invalid JSON in data string
  • Missing path for query operation
  • Invalid array index in path
ExecutionFailed
  • 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:
  1. Split on . to get segments
  2. For each segment, check for array indexing [n]
  3. Navigate to field, then to array index if present
  4. Return final value

OpenAI Compatibility

The data parameter is intentionally freeform (no type constraint) for OpenAI compatibility. OpenAI rejects union types containing array unless items is also specified.

Build docs developers (and LLMs) love