G
GoTool

JSON Formatter

Online JSON formatter, validator and minifier. Auto-detects and converts Go struct, Python dict/dataclass, Java Lombok/class, Rust Debug, PHP print_r and more to standard JSON

Indent:
Input
Output

JSON Formatter

JSON Formatter is an all-in-one online JSON tool — format, validate, and minify JSON, while also converting data structures from multiple programming languages directly to standard JSON, all in a single input box. Supported Input Formats - Standard JSON / JSONC / JSON5 — comments, trailing commas, and unquoted keys all handled automatically - Go%+v / %#v runtime output, and type Foo struct {} struct definitions - Python — dict literals (single quotes, True/False/None, tuples), plus dataclass, pydantic BaseModel, and TypedDict class definitions - JavaMap.toString() output, Lombok @ToString logs, and class / POJO field definitions - Rust{:?} / {:#?} Debug output, and pub struct / enum definitions - PHPprint_r(), var_dump(), and var_export() output - Log extraction — automatically locates and extracts embedded JSON from log lines Key features: auto format detection, auto-clean surrounding noise, auto-repair broken JSON syntax, Tree view, syntax highlighting, and large file (100KB+) support. All processing runs locally in your browser — nothing is uploaded.

Frequently Asked Questions

How do I convert a Go struct to JSON?

Paste the output of `fmt.Printf("%+v", obj)` or `fmt.Printf("%#v", obj)` directly into the input box — the tool auto-detects Go struct format and converts it to valid JSON. Pasting a `type Foo struct {}` definition also works and generates a JSON example structure.

Can I convert Python dict or dataclass to JSON?

Yes. Paste Python dict literals (single quotes, True/False/None, tuple syntax) or class definitions (dataclass, pydantic BaseModel, TypedDict) and the tool converts them automatically to standard JSON.

Does it support Java Lombok toString and class definitions?

Yes. Paste Java Lombok toString() output (e.g. `UserDTO(id=1, name=Alice, ...)`), Map.toString(), or a class/POJO field definition and the tool parses it into standard JSON.

What about Rust and PHP formats?

Both are supported. Rust `{:?}` / `{:#?}` Debug output and `pub struct` / `enum` definitions, as well as PHP `print_r()`, `var_dump()`, and `var_export()` output can all be converted to JSON.

What is the difference between format and minify?

Format adds indentation and line breaks to make JSON readable — great for debugging. Minify removes all unnecessary whitespace to reduce payload size, which is useful in production environments.

Is my data uploaded to a server?

No. All formatting, parsing, and conversion happens entirely in your browser's JavaScript engine. Your data never leaves your device and is never sent to any server, so it's safe to paste internal code or sensitive data.