Developers · Gutenberg

JSON Formatter block for WordPress

Validate, format (pretty-print), and minify JSON with syntax highlighting and one-click copy.

Get Blockenberg

Free Gutenberg block in Blockenberg. The inspector controls and front-end behavior on this page come from this block’s source, not a shared stub.

Get Blockenberg

What it actually does

Validate, format (pretty-print), and minify JSON with syntax highlighting and one-click copy.

Inspector panels on this block: Content, Display, Sizing. Those titles come from index.js, not from a shared template.

Behavior controls: “Indent size” options: 2 spaces, 4 spaces, 1 tab.

Where to find it

Gutenberg inserter → Developers → search “JSON Formatter” (block name `blockenberg/json-formatter` in block.json). Style it in the sidebar after insert.

How to use JSON Formatter block for WordPress

  1. Install Blockenberg. Install from WordPress.org and activate the plugin.
  2. Insert the block. Edit a page, click +, search for “JSON Formatter”, insert it. Category: Developers.
  3. Configure inspector controls that exist on this block. Open Content. Set “Content — Title”, “Subtitle”, “Indent size”, “Size (px)”.
  4. Check the published page. The view script reads HTML data attributes: data-opts. The block editor preview may not run the same view script.

Inspector controls from this block’s code

ControlWhat the code does
Content — TitleText field in the inspector. block.json default: JSON Formatter & Validator. Saved as `title`.
SubtitleText field in the inspector. block.json default: Paste JSON to validate, format, or minify it instantly.. Saved as `subtitle`.
Indent sizeSelect control; the chosen value is saved on the block. Options: 2 spaces; 4 spaces; 1 tab. block.json default: 2. Saved as `indentSize`.
Size (px)Numeric range control in the inspector. Range 8–72. block.json default: 13. Saved as `outputFontSize`.
WeightNumeric range control in the inspector. Range 100–900. block.json default: 400. Saved as `outputFontWeight`.
Line HeightNumeric range control in the inspector. Range 0.8–3. block.json default: 1.6. Saved as `outputLineHeight`.

What the front-end script actually does

When this is the right block

Notes from the implementation

viewScript: this folder’s frontend.js is enqueued on the front end for this block.

FAQ

How do I add the JSON Formatter block in WordPress?

Install Blockenberg from WordPress.org, edit a page in the block editor, click +, and search for “JSON Formatter”. It sits under Developers. After insert, open Content and set “Content — Title”, “Subtitle”, “Indent size”, “Size (px)”.

Does JSON Formatter generate a PDF on the server?

No. It opens the browser print dialog. Visitors can choose Save as PDF there.

Is the JSON Formatter Gutenberg block free?

Yes. JSON Formatter ships inside Blockenberg. Get the plugin from WordPress.org — no paid add-on is required for this block.

Can I style JSON Formatter to match my theme?

Yes. Blockenberg’s shared typography and color panels apply here, plus any block-specific style controls listed on this page (panels: Content, Display, Sizing).

Related developers blocks

Get Blockenberg

Install Blockenberg from WordPress.org, then insert JSON Formatter from the Gutenberg inserter.

Get Blockenberg