Search Ctrl K
Home / Tools
THE FEUTEX TOOLKIT

Ruby Hash Formatter Online

Format Ruby Hash literals online: pretty print or minify, normalize :symbol keys vs hash rockets, optional key sorting, and JSON output. No eval, runs in your browser.

Notes: supports common literals ({}, [], strings, numbers, true/false, nil, symbols) and both => and key: hash syntax.
Privacy: runs locally in your browser. No uploads, no tracking scripts.

How to use

Use this formatter to clean up Ruby Hash literals (including nested hashes/arrays).

  1. Paste your Ruby hash into the input box.
  2. Choose options (Pretty/Minify, indent, quote style, key sorting, output format).
  3. Click Format (or Minify).
  4. Copy the result from the output area.

FAQ

Is this formatter safe to use with untrusted input?

Yes. It does not run Ruby or use eval; it parses a limited Ruby-literal subset in JavaScript.

What Ruby hash syntax is supported?

Common literals: hashes ({}), arrays ([]), strings, numbers, booleans, nil, symbols, and both key: and => pairs.

Can it convert hash rockets to <code>key:</code> syntax?

Yes, when the key is a simple symbol name it will output key:. Other keys keep =>.

Does it preserve comments and complex Ruby expressions?

No. Comments are ignored, and complex expressions (method calls, constants, heredocs, etc.) are not supported.

Can I sort keys for stable diffs?

Yes. Enable “Sort hash keys” to output keys in a consistent order.

Can I output JSON instead of Ruby?

Yes. Switch Output to JSON; symbols become strings and nil becomes null.

Why am I getting a parse error on valid Ruby code?

This tool intentionally supports only Ruby literal subsets. If your hash contains non-literals, simplify it (or replace values with placeholders) before formatting.

Continue your workflow

Browse related tools by task. Use the improved core tools for a consistent workspace with file import, downloads and clear validation errors.