Java Map Pretty Formatter

Pretty print Java Map toString output into a readable nested structure directly in your browser.

  • Browser based
  • Local processing

Your input and output stay in your browser. Nothing is sent to a server.

What is Java Map Pretty Formatter?

Java Map Pretty Formatter is a browser-based tool that indents text resembling the output of Java Map's toString() method. It turns a string such as {name=kim, age=30, address={city=seoul}} into readable lines that show its nested structure.

The tool preserves Java Map-style syntax, including equals signs between keys and values. It formats the text; it does not convert it to JSON.

How to use

  1. Paste Java Map-style text into Input.
  2. Select 2 spaces or 4 spaces for indentation.
  3. Press Format.
  4. Review Output and press Copy to copy the result.

Use Sample to load example data before trying Format.

Supported input

  • Maps enclosed in {} and Lists enclosed in [].
  • Keys and values separated by =, with items separated by commas.
  • Nested Maps and nested Lists.
  • Maps inside Lists and Lists inside Maps.

For example:

{name=kim, age=30}
{name=kim, address={city=seoul}}
{skills=[Java, Spring]}
{users=[{name=kim}, {name=lee}]}

Scalar values such as 30, true, and null remain text; their types are not inferred.

Example

Input

{name=kim, age=30, address={city=seoul, zip=12345}, skills=[Java, Spring]}

Output (4 spaces)

{
    name=kim,
    age=30,
    address={
        city=seoul,
        zip=12345
    },
    skills=[
        Java,
        Spring
    ]
}

Current limitations

Double-quoted scalar values are supported, including commas and structural characters. Only escaped double quotes and backslashes are decoded; other escape sequences are preserved literally. Full Java escape grammar, single-quoted values, and quoted keys are not supported.

Java DTO toString() formats, such as User(name=kim, age=30), are not supported.

Privacy

Formatting runs locally in your browser. Your Java Map data is not sent to or stored on a server. Read our Privacy Policy for details.

Have the original Map object? Read How to Pretty Print a Java Map for Java iteration, Jackson, and Gson examples.