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.
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) |