Java Map to JSON Converter

Convert Java Map-style or Map toString output into formatted JSON 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 to JSON Converter?

Java Map to JSON Converter is a browser-based tool that parses Java Map-style text and converts it into JSON-compatible values. Maps become JSON objects, Lists become arrays, and scalar text is converted using the type rules below.

Java Map Pretty Formatter keeps the original Map-style syntax and adds indentation. This converter produces JSON with quoted keys and string values, colons between keys and values, and inferred scalar types.

How to use

  1. Paste Java Map-style text into Input.
  2. Select 2 spaces or 4 spaces for indentation.
  3. Press Convert.
  4. Review the result in JSON Output.
  5. Press Copy to copy the JSON.

Use Sample to load example data, then press Convert to try it.

Type conversion

Double-quoted scalar values always become JSON strings. For unquoted values, the converter recognizes lowercase true, false, and null. Integers and decimal values, optionally beginning with a minus sign, become numbers when they produce a finite JavaScript number and have no extra leading zeros. Other values remain strings.

Scalar text and its JSON result
InputJSON outputType
3030number
-10-10number
10.510.5number
truetrueboolean
falsefalseboolean
nullnullnull
kim"kim"string
00123"00123"string

Values with extra leading zeros, such as 00123, stay strings to preserve the original digits. A value such as 0.5 can still become a number.

Supported structures

  • Maps enclosed in {}, with = between keys and values.
  • Lists enclosed in [], with commas separating items.
  • Nested Maps and nested Lists.
  • Maps inside Lists and Lists inside Maps.

Example

Input

{name=kim, age=30, active=true, skills=[Java, Spring]}

Output (2 spaces)

{
  "name": "kim",
  "age": 30,
  "active": true,
  "skills": [
    "Java",
    "Spring"
  ]
}

Current limitations

  • Double-quoted scalar values support 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.
  • Duplicate Map keys become a single JSON object property; the last value is kept.
  • Double-quoted values always become JSON strings. Unquoted scalar type inference uses only the rules above. For example, 1e3 and +10 remain strings.
  • Converted numbers follow JavaScript number precision limits, so very large integers may lose precision.

Privacy

Conversion runs locally in your browser. Your input and results are not sent to or stored on a server. Read our Privacy Policy for details.

For Java object serialization and handling text copied from logs, read How to Convert a Java Map to JSON.