Convert a Ruby hash to JSON
ruby_to_jsonParse Ruby hash or array literals (symbol keys, hashrockets, nesting) into clean, alphabetically sorted JSON. Symbols become ':name' strings.
Instructions
Parse a Ruby hash or array literal (hashrockets, symbol keys, shorthand syntax, nesting, nil/true/false) and return clean JSON with alphabetically sorted keys. Symbols are rendered as ":name" strings.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"hash": "<hash>"
},
"name": "ruby_to_json"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| hash | Yes | Ruby hash or array literal, e.g. {name: "x", "role" => :admin} | |
| sort_keys | No | Sort hash keys alphabetically (default true) |