No matching section
Try a shorter term, clear the product filter, or search for the name shown in the Tools or More Actions menu.
Getting started
CodePrettify turns supported code, data, configuration, documentation, and feed files into a read-only working view. It keeps the original text available while adding formatting, validation, navigation, conversion, and inspection tools.
Browser extension
- Install from the Chrome Web Store, Microsoft Edge Add-ons, or the supported Firefox distribution (Firefox 142 or newer).
- Open a supported raw HTTP/HTTPS resource. CodePrettify recognizes the URL extension or response content type and replaces the plain browser page with its viewer.
- For a local file, click the CodePrettify toolbar button to open the launcher, then drag the file in or choose it. Direct
file://URLs additionally require the browser’s Allow access to file URLs permission. - Use Prettified/Raw, or Rendered/Source for markup, to change representation without changing the source file.
Windows app
- Open a file with Ctrl+O, drag files into the window, use a file association/Explorer command, or choose File > Paste & Prettify.
- Each file opens in a tab. New installations start in Prettified, Rendered, or Table view according to the file type.
- Use native Save/Save As when you want to write the selected representation back to disk.
Supported formats
| Format | Extensions | Extension | Windows app | Default view |
|---|---|---|---|---|
| JavaScript / TypeScript | .js .mjs .cjs .ts .mts .cts | Yes | Yes | Prettified |
| JSON / JSONC | .json .jsonc | Yes | Yes | Prettified |
| JSON Lines / NDJSON | .jsonl .ndjson | Yes | Yes | Prettified |
| YAML | .yaml .yml | Yes | Yes | Prettified |
| TOML | .toml | Yes | Yes | Prettified |
| Markdown | .md .markdown | Yes | Yes | Rendered |
| CSS | .css | Yes | Yes | Prettified |
| XML / RSS / Atom | .xml .rss .atom | Yes | Yes | Rendered |
| CSV | .csv | No | Yes | Table |
| HTML | .html .htm | No | Yes | Rendered |
The extension can also activate when a supported response MIME type is returned without a recognizable filename. It intentionally leaves normal HTML pages alone. The Windows app can use Paste & Prettify to detect a format even when no filename exists.
The viewer workspace
Representations
- Prettified shows indentation, syntax highlighting, folding, links, and inline helpers. Raw shows the original text.
- Markdown, XML/feed, and app HTML use Rendered/Source where a safe rendered view is available.
- The formatting indicator reports whether formatting succeeded. A validation alert provides an exact line/column when the parser can locate the problem.
- Ctrl+B toggles the two views. Your first-install default remains Prettified/Rendered until changed in Settings.
Editor and status
Line numbers, word wrap, folding, the minimap, and the floating toolbar can be enabled independently. The Windows app’s status bar reports line and character totals, cursor line/column, selection size, detected type, encoding, and line-ending style; in the extension, line and size totals are available through Statistics & Diagnostics.
Floating toolbar
The toolbar exists in the Prettified/Rendered view (it is hidden in Raw/Source) and combines the copy menu, live search, Go to Line, and More Actions. More Actions is split into two groups:
- For this file — the heading names the detected format, for example For this file · JSON — contains actions that analyze or operate on the active document: Export, Statistics & Diagnostics, Security Scan, and, when folding is available, Collapse All and Expand All on one paired row, plus tools specific to the detected format. For example, JSON adds Table View, JSON Path Inspector, and Schema Validator, while JavaScript adds Document Navigator and Inspect Runtime. HTTP response metadata and timing, when available, appear as a section inside Statistics & Diagnostics.
- General tools contains always-available utilities that work without the open document: Compare, JSON to Code Generator, JSON Repair & Transform, JavaScript Playground, Data Converter, Regex Playground, and HTTP Client. Compare, JSON to Code Generator, JSON Repair & Transform, and JavaScript Playground can load a compatible current document, and Regex Playground tests against the current document by default (switchable to custom text). This column is visually subdued until hovered or focused.
On wider windows, the primary file-actions column is centered above the More Actions button; constrained windows keep the menu inside the viewport, and very narrow windows stack both groups.
Up to three tools you repeatedly use can become adaptive quick buttons: an action qualifies after about ten uses, and the three most-used win. On narrow windows those learned buttons are hidden to keep the core controls on one row; all tools remain in More Actions or the Command Palette.
Command Palette
Press Ctrl+Shift+P and type part of an action name. Document-specific commands follow the active format, while general tools such as JSON to Code Generator and JSON Repair & Transform stay available everywhere. This is also the fastest way to find less-visible functions such as Security Scan.
Extension workflows
Automatic activation
The extension examines the resource URL and response content type. Supported raw documents are enhanced automatically; ordinary web pages are not. Disabling a type in Settings affects newly opened resources.
Launcher and local files
The launcher can open a supported file by picker or drag-and-drop without broad file access. It can also start the Editor, JSON to Code Generator, HTTP Client, JavaScript Playground, Regex Playground, or Data Converter. If the tab you clicked from is a supported viewer, the tool opens on that document in the same tab; otherwise the tool opens on a hosted sample document in a new tab. Launcher files are limited to 10 MiB. Encoding is detected from a UTF-8 or UTF-16 (LE/BE) byte-order mark; without one, strict UTF-8 is tried with a Windows-1252 fallback.
Persisted and shareable state
For the same resource, CodePrettify can restore search text, highlighted line, folds, scroll position, and the Prettified/Raw (or Rendered/Source) choice without changing the URL. This state is short-lived: it is kept for about one hour and only for the ten most recently viewed resources. Display settings follow your global Settings. Share Configuration URL explicitly encodes selected viewer configuration, including a settings subset, in the hash for an HTTP/HTTPS resource; it does not include the resource body.
What’s New
After a release with substantial new functionality, the extension can show the changes since the last version you used. The announcement appears once, in the first CodePrettify viewer tab you open after the update, and lists every feature release since the version you last used. Never show again stores that preference locally. Small maintenance releases do not need their own announcement.
Files, tabs, Paste & Prettify, and saving
Tabs and sessions
Open several files in native tabs. Opening the same path reuses its tab. Close with the tab button, middle-click, or Ctrl+W; closing the final tab returns to the open-file landing surface. The app keeps up to ten recent files, integrates with Windows Recent Documents, and can restore the previous window, tabs, and active tab when session restore is enabled. Session state is checkpointed continuously, so restore also works after a crash, and opening files from Explorer reuses the running window instead of starting a second instance.
Paste & Prettify
Press Ctrl+N — the dialog pre-fills with your current clipboard text, which you can replace or edit — and either keep Auto-detect or choose a type. Detection checks JSON, JSON Lines, tolerant JSONC, HTML/XML, fenced Markdown, high-confidence JavaScript, TOML, JavaScript statements, CSS, YAML, CSV, and Markdown/plain text. The dialog accepts up to 16 MiB; larger clipboard content should be saved and opened as a file so large-file safeguards can be used.
Save and Save As
- Raw/Source saves the original source. Prettified/Rendered/Table saves the document representation, never the viewer’s interface HTML.
- If another program changed the disk file, choose Overwrite, Save As, or Cancel.
- Saving formatted JSONC warns that comments and trailing commas will be removed; No is the default.
- The app preserves the original encoding/BOM when possible, writes saves atomically, and warns when a legacy encoding would lose characters. Unsaved and native large-file tabs use Save As; comparison tabs cannot be saved.
External changes
A file watcher reloads the tab automatically when the file changes outside CodePrettify, follows renames, and reports deletion in the status bar and window title. This is separate from the app’s session recovery.
Formatting and validation by file type
JSON / JSONC / JSON Lines
JSONC accepts comments and trailing commas, not JSON5 single quotes or unquoted keys; that tolerance applies to whole documents only. Formatted JSONC omits comments. JSON Lines validates each nonblank physical line as strict JSON and formats it to one compact record per line so the file stays valid JSONL, while the structured view still shows each record expanded. Validation reports the error’s line and column (line only for JSON Lines) and warns when integers are too large to survive reformatting without precision loss.
JavaScript / TypeScript
The bundled beautifier adds readable indentation. Syntax is validated in a sandboxed parser; when validation cannot run, the document is marked as unchecked rather than invalid. Folding recognizes multi-line functions, classes, control blocks, arrays, and objects while ignoring brackets inside strings, comments, and template-literal interpolations. Bracket matching is optional. Safe HTTP(S) URLs and resolvable relative imports become clickable; bare package names are not guessed.
YAML
Formatting deliberately normalizes newlines instead of re-dumping the document, which could lose comments, anchors, scalar styles, whitespace meaning, or numeric precision. Multi-document YAML is validated. There is no misleading minified copy.
TOML
Formatting and “minification” are the same canonical reserialization: both drop comments and blank lines, because TOML has no compact grammar. Source containing sub-millisecond temporal precision is kept unchanged to avoid truncation.
Markdown
Rendered mode supports links, task lists, footnotes, selected emoji shortcodes, and heading anchors. Raw HTML is escaped, dangerous schemes are blocked, and remote images become inert links/placeholders so viewing a document makes no automatic image request. Minification only collapses safe repeated blank lines.
In-depth guide: See local and remote file workflows, rendered/source examples, and privacy behavior in Markdown Viewer for Chrome, Edge, and Windows.
CSS
Formatting/minification respects strings, comments, functions, data URLs, and calculations. Validation flags unmatched braces, parentheses, and brackets; the browser extension additionally reports unclosed strings/comments and declarations missing a colon. HTTP(S) URLs/imports can be clicked. Minification preserves /*! … */ license comments. Color swatches attach to hex and rgb()/hsl() values (not named colors) and open a picker with adjusted and copyable HEX/RGB/HSL values.
XML / RSS / Atom
Strict parsing reports line/column. In the browser extension, formatting avoids mixed content, preserved whitespace, internal DTD subsets, and quoted markup where a rewrite could change data, and “minification” is byte-preserving because whitespace-only text nodes may matter. The Windows app reformats any well-formed document, and its minification strips comments and collapses whitespace. Folding, safe links, timestamps, and encoded-value hints remain available.
CSV and HTML (app)
CSV detects comma, semicolon, tab, or pipe delimiters with quote-aware parsing and provides Table plus source. HTML formatting preserves raw script/style text (reformatting can change whitespace inside <pre> blocks), escapes rendering safely, supports folding, and can make safe URLs clickable.
JSON helpers and JSON Path Inspector
Structured JSON adds folding, clickable URLs, human-readable timestamp hints (for integer Unix values dated 2000–2050 and ISO-like strings), and hover/click decoding for likely JWT or Base64 strings. Enable the hover breadcrumb (off by default) to see the path under the pointer; the click inspector, on by default, opens JSON Path Inspector when you click a property name.
Run a JSON Path query
- Open JSON Path Inspector from More Actions, the Command Palette/Tools menu, or by clicking a property name. Breadcrumb segments jump to that node in the document; hovering also sets the inspector’s starting path.
- Start with
$. Use dot properties, quoted bracket properties, numeric indexes, or[*]. Autocomplete suggests keys. - Run the query. Copy the current path or a compact JSON/display value, or select a result to jump to its source line.
Scope: the inspector intentionally does not implement filters, slices, recursive descent, or script expressions. It renders at most 200 results and autocomplete shows at most 50 keys. It also works on JSON Lines documents, where $[0] addresses the first record, and a leading $ is optional in queries.
In-depth guide: Follow a complete JSON workflow with formatting, folding, JSONPath samples, schema validation, comparison, and export in JSON Formatter and Viewer.
Table View
Table View is available for compatible JSON arrays of objects and repeating XML/RSS structures; the app also uses it for CSV (CSV files open directly in Table View when CSV formatting is enabled) and for HTML documents with a repeating tabular structure. In the extension, mixed JSON arrays are rejected rather than silently dropping primitive rows; the app shows the object rows and omits primitive entries.
- Search the entire table or filter individual columns.
- Click a column to sort; drag columns to reorder them.
- Expand long cells and optionally show column summaries such as dominant type, unique values, and empty counts. Summaries cover the first 12 columns, and the toggle state is remembered.
- Select individual rows or all rows matching the current filter, then export the selection as CSV or JSON in the current column and sort order. Export the current filtered/sorted table as HTML.
- Large tables use virtual rendering from roughly 1,000 rows so the view remains responsive.
CSV export: JSON must be a nonempty top-level array of flat objects; nested arrays/objects are not flattened. XML/RSS needs a repeating structured element.
Diagram Generator
Diagram Generator is a contextual tool for structured documents. Open it from For this file in More Actions or from the Command Palette; the Windows app also exposes it in Tools. Both products support JSON, JSON Lines, YAML, TOML, and XML/RSS documents. The Windows app additionally supports CSV files.
- Open a JSON, JSON Lines, YAML, TOML, XML/RSS, or, in the Windows app, CSV document in the prettified view and choose Diagram Generator.
- Choose Left to right for a compact reading flow or Top to bottom for a conventional hierarchy. Use Include compact values to show or hide short primitive values, XML text/attributes, and CSV cells.
- The near-full-window workspace keeps direction, value options, generation status, and downloads in the compact left sidebar so the live diagram can use the remaining width and full height.
- Normal clicks never change the viewport; clicking within a card only selects that card, and each field row highlights when you hover over its key and value. Click the minus button on a reference row to collapse its child branch, or the resulting plus button to restore it. Click a more fields row to reveal the remaining bounded fields in that card. These interactions preserve the parent card's screen position and the current zoom. Double-click a card heading to smoothly center and focus that element; focus the heading and press Enter or Space for the keyboard equivalent, or Shift-double-click the heading to zoom out around it. Drag the dotted canvas to pan, use the mouse wheel or a pinch gesture to zoom around the pointer, press the arrow keys to nudge the view, or use the floating zoom and Fit controls to return to the complete hierarchy.
- Type in the sidebar Search box to find cards and fields. Matching cards are ringed and their matching rows highlighted while everything else dims, and a counter reports the match total. Press Enter or use the previous and next controls to step through the matches; each step centers and focuses that card. Press Escape in the search box to clear the query without closing the tool.
- Click any field row to open the Field details panel with the full untruncated value and its document path; Copy value and Copy path put either on the clipboard. Selecting a card also highlights its complete ancestor chain of cards and connectors, so you always see where a record sits in the hierarchy.
- Use the Levels control to bound the diagram to two, three, or four card levels for a quick structural overview, or Collapse All to fold every branch behind re-expandable plus buttons and Expand All to restore them.
- Choose Download SVG for a scalable, self-contained diagram or Download PNG for a bitmap image. The Windows app routes both formats through its native Save dialog. Copy Mermaid puts the same cards, fields, and connections on the clipboard as a Mermaid class diagram for documentation, wikis, and issue trackers. The export includes every field of each card, even rows the on-screen card keeps behind its more fields disclosure.
JSON objects and array records become cards with primitive properties grouped into field rows; primitive arrays such as regions show their compact entries directly, while nested objects and record arrays branch from the exact reference row. YAML mappings and TOML tables map the same way, YAML and TOML timestamps render as date values, and a multi-document YAML source becomes one card per document. JSON Lines becomes a root card connected to one card per record. XML elements use the same card structure for attributes, direct text, and child elements. CSV becomes a root card connected to one record card per row, with columns shown as fields; comma, semicolon, tab, and pipe delimiters are detected automatically. The interactive preview is a live DOM scene: cards and fields are semantic HTML elements and connectors are inline SVG paths, rather than a scaled preview image. This keeps focused text crisp and provides a foundation for future editing. Pastel headers distinguish cards, hexadecimal color values include swatches, and the dotted canvas is preserved in exported images.
Local and bounded: the source never leaves the device. Input is capped at 5 Mi characters, diagrams at 160 cards, 14 nesting levels, and 12 visible fields per card by default. A card can reveal up to 40 fields through its disclosure row; any remaining safety limit is reported as limited for readability. Text is escaped before SVG rendering. PNG output is scaled to stay within an 8,192-pixel edge and a bounded pixel budget.
JSON Schema Validator
- Open a normal JSON or JSONC document (JSON Lines is not supported).
- Open JSON Schema Validator, paste a schema, and choose Validate or press Ctrl+Enter.
- Inspect each violation’s instance path, keyword, message, schema path, and source line. Select a result to jump.
Core types, enum/const, numeric/string/object/array constraints, composition, conditionals, dependencies, safe regular expressions, and common formats are supported. Validated formats are email, hostname, ipv4, ipv6, uuid, date, time, date-time, uri, uri-reference, and regex; unrecognized format names are ignored rather than validated. Regular expressions with backreferences, lookarounds, repeated groups containing alternation or inner quantifiers, consecutive overlapping quantifiers, or more than 512 characters cause the schema to be rejected as too complex. Validation is completely local.
Limits: schema input is capped at 2 MiB, with depth 80, 100 reported errors, 100,000 validation operations, and about 2.5 seconds — the operation and time budgets apply separately to schema checking and to document validation. Only local # references/anchors are resolved; remote schemas are never downloaded. unevaluatedProperties is reported as unsupported. The pasted schema is kept for the session, and a run that hits any limit is never reported as valid.
In-depth guide: See a real schema produce path- and line-specific violations in JSON query and validation examples.
Statistics, Diagnostics, and Security Scan
Open Statistics & Diagnostics from More Actions or the Command Palette; the Windows app also lists both in the Tools menu. They are two sections of one combined panel — the Diagnostics command opens it scrolled to the Diagnostics section.
Statistics
All formats report original/formatted/minified estimates, lines, characters, and characters without whitespace. JSON adds structure depth and value counts; JavaScript adds declarations/modules/comments; CSS adds rule/property/variable/import/color counts; XML/feed adds element, attribute, namespace, text, comment, and CDATA counts.
Diagnostics
Diagnostics combines syntax status with warnings for long lines (over 300 characters), large documents (over 5,000 lines), and mixed indentation. Depending on format it can identify duplicate JSON keys, JSONC, suspicious timestamps (10–13 digit values outside the recognized Unix range, or invalid ISO-like dates) and URLs, embedded JWT/Base64/URL values, pagination/GraphQL/OpenAPI/schema shapes, feed issues, JavaScript/CSS summaries, HTTP response context and timing in the extension (for documents served over HTTP/HTTPS), and practical quick-fix guidance. Every report also includes a CSV readiness check that states whether the document can be exported to CSV and why.
Security Scan
Run Security Scan from More Actions or the Command Palette; the Windows app also lists it in the Tools menu. It looks locally for likely cloud/API keys, tokens, private-key blocks, credential-bearing URLs, connection strings, API routes, paths, and file references. Secret findings are masked (leading and trailing characters plus length only) and sorted by severity; endpoint findings are deduplicated and grouped by kind. Every finding links to its source line, and rows also activate with Enter or Space. Selecting a finding reveals any folded parent blocks and centers the exact displayed line while leaving unrelated folds closed; Copy endpoints copies only the endpoint list.
Important: this is heuristic assistance, not a security guarantee. It may produce false positives and false negatives. A scan examines at most 5,000,000 characters and reports at most 1,000 secret findings and 1,000 endpoint findings; partial results are clearly marked.
Data Converter
Open Data Converter from More Actions, the Command Palette, Tools, or the extension launcher. Its four tabs keep related conversion utilities together: Convert, Hash & HMAC, Timestamp, and ID Generator. On Convert, Use document loads the active text. Choose an operation and press the Convert button beside it. Reverse moves the output into input and selects the inverse. Copy and Download sit together beside output. Inside the dialog, Ctrl+Enter generates on the Hash tab, Enter converts on the Timestamp tab, and the arrow keys cycle the four tabs.
Hash & HMAC
Choose the Hash & HMAC tab to create SHA-256, SHA-384, or SHA-512 output from pasted text or the current document. Hash mode produces a normal digest. HMAC mode also requires a secret key and produces a keyed authentication code. Both hex and Base64 representations can be copied. Text and keys are interpreted as UTF-8, remain in memory only for the open page, are never saved or transmitted, and are capped at 16 MiB each.
Unix / ISO timestamps
The Timestamp tab converts Unix seconds, Unix milliseconds, or ISO 8601 values with Z or an explicit ±HH:MM UTC offset; ISO seconds and fractions (up to nine digits) are optional, and negative or fractional Unix values are accepted. Auto-detection treats absolute values below 100,000,000,000 as seconds and larger values as milliseconds; choose the unit explicitly for far-future dates or early-epoch millisecond values. Use current time fills the present moment in milliseconds. Results include UTC ISO 8601, Unix seconds, Unix milliseconds, and local system time. Ambiguous date strings without a timezone are rejected instead of silently assuming one.
UUID & ULID generation
The ID Generator creates 1–100 UUID v4, UUID v7, or ULID values per batch. UUID v4 is random; UUID v7 and ULID embed the current Unix-millisecond timestamp and use monotonic random portions so a same-millisecond batch remains lexicographically sorted. Generation requires the platform’s cryptographically secure random source and never falls back to Math.random().
| Operation | What it does |
|---|---|
| Prettify JSON | Parses valid JSON and writes readable indentation. |
| Minify JSON | Parses valid JSON and removes insignificant whitespace. |
| Stringify JSON | Turns a JSON value into a JSON string literal. |
| Parse JSON | Turns a JSON string literal back into its contained JSON value. |
| Escape JSON | Escapes quotes, backslashes, control characters, and unpaired surrogates for embedding in a JSON string. |
| Unescape JSON | Decodes valid JSON escape sequences to characters. |
| JSON → XML | Maps JSON types into a namespace-aware XML representation; a previously produced $xml mapping is reconstructed back into the original XML. |
| XML → JSON | Uses an ordered $xml model to preserve attributes, namespaces, text, CDATA, comments, processing instructions, and order; XML in CodePrettify’s typed JSON vocabulary decodes back to plain JSON, so both directions round-trip via Reverse. |
| JSON → CSV | Converts a flat array of objects to comma-separated rows. |
| CSV → JSON | Parses a compatible delimited table into an array of objects. |
| JSON → YAML | Serializes compatible JSON values as YAML. |
| YAML → JSON | Parses YAML values and serializes them as JSON. |
| JSON → TSV | Converts a flat array of objects to tab-separated rows. |
| TSV → JSON | Parses a compatible tab-separated table into objects. |
| Base64 Encode | Encodes UTF-8 text as standard Base64. |
| Base64 Decode | Strictly validates Base64 (no whitespace or line breaks, standard or URL-safe alphabet but not mixed, padding optional yet exact when present) and decodes it as UTF-8 text. |
| URL Encode | Percent-encodes text for safe use in a URL component. |
| URL Decode | Decodes valid percent-encoded text. |
Compatibility and safety
Operations proven incompatible with the current input are disabled with a reason; other choices remain selectable. JSON conversion refuses unsafe integers, -0, out-of-range values, and decimals that JavaScript would silently change. CSV/TSV requires flat tabular data and protects spreadsheet-formula-leading text: import treats the first row as a unique header row, rejects rows longer than the header, and returns every field as a string without type inference, while export unions all object keys into the header and leaves missing values empty. YAML conversion cannot preserve comments, anchors, tags, or scalar styling, and aliases that reuse arrays or objects are rejected outright to prevent unsafe expansion.
Limits: 10 Mi characters input, 32 Mi characters output, plus YAML bounds of 500,000 values and 512 nesting levels. Base64 decode must produce valid UTF-8.
JSON to Code Generator
JSON to Code Generator is a general tool, so it remains available in More Actions and the Command Palette for every file type. The extension also exposes it from the launcher, and the Windows app includes it in Tools. Paste any strict JSON sample or choose Example; when opened on a JSON document, the sample is loaded automatically the first time, and Use document reloads it at any point. Generation runs entirely on the device.
- Enter one JSON object, value, or array of sample records in JSON sample.
- Choose a Target, set the Root type name, and, where supported, adjust the package or namespace. That field appears for C# (Namespace, default
Generated), Java and Kotlin (Package, defaultcom.example.generated), and Go (Package, defaultmain); invalid entries are normalized automatically. - Optionally enable Make every property optional. Otherwise, properties missing from some array samples become optional automatically, while an explicit
nullbecomes nullable. - Review the live generated code and any inference warning, then Copy to clipboard, Open as document, or Export. Press Ctrl+Enter in the sample box to generate immediately.
The example below converts an advanced order payload—with nested customer data, line items, nullable discounts, tracking events, payment totals, tags, and metadata—into ready-to-use C# models with System.Text.Json annotations and a project namespace.
| Target | Generated result |
|---|---|
| TypeScript | Nested exported interfaces and root aliases with unions, optional fields, and exact source keys. |
| Zod | Composable schemas plus an inferred TypeScript root type. |
| C#, Java, Kotlin | Records or data classes with JSON field-name annotations and namespace/package support. |
| Python / Pydantic | Pydantic models with snake_case field names and Field aliases whenever the field name differs from the source key. |
| Go, Rust, Swift, Dart | Native model declarations with json, Serde, Codable, or json_serializable mappings. |
| JSON Schema | A Draft 2020-12 schema with inline nested object schemas, required lists, arrays, anyOf unions, and nullability. |
Inference behavior
Nested objects become named models. When the root is an array, all array entries contribute to inference rather than only the first record. Different compatible shapes are merged; genuinely mixed values become unions where the target supports them and a safe general type where it does not. Empty arrays cannot reveal their element type: they are counted into a single informational warning, and the target's safe unknown type is used only when no sample populates the array — otherwise a populated sample's element type wins. Property names such as user-id, reserved words, and other invalid identifiers receive the target's normal field-mapping annotation instead of changing the JSON contract. Array property names are singularized when naming element types (addresses becomes Address), and integers map to 64-bit types in typed targets. Make every property optional goes beyond adding ?: it removes JSON Schema required lists and uses Option, pointer, or nullable forms with defaults where the target needs them.
Limits: input is capped at 5 Mi characters, generated output at 16 Mi characters, nesting at 100 levels, and inspected JSON values at 100,000. Invalid or incomplete JSON reports its line and column when available. Limits fail closed and never alter the source document.
In-depth guide: Compare TypeScript and Python/Pydantic output from the same multi-sample payload in JSON to Code Generator.
JSON Repair & Transform
Open JSON Repair & Transform from General tools in More Actions or from the Command Palette; the Windows app also exposes it directly in Tools. It is available for every supported document type because pasted JSON-like input works independently of the active document; in the Windows app it requires an open document tab in prettified view. A compatible current document remains an optional starting point through Use document. All processing stays on the device. Its two tabs are designed as one workflow: review and normalize the source in Repair & Salvage, then pass that result to Transform. Both tabs retain the same dialog height when switching, and the Repair input, repaired output, and live Transform result use the shared compact code-text scale while preserving useful editor space.
In-depth guide: Walk through fenced, Python-style JSON repair and a filter-and-sort recipe in JSON Repair & Transform.
Repair & Salvage
- Review or replace Input to analyze. Use document restores the active document text.
- For JSON Lines only, enable Salvage valid JSON Lines records when some records are invalid if you deliberately want invalid records excluded. Leave it off when every record must survive.
- Choose Analyze & repair. Review the confidence, each recorded repair, warnings, and any discarded source-line numbers before using the result.
- Copy or download the repaired JSON, or choose Use result in Transform.
The repair engine can remove a byte-order mark or Markdown fence, extract the first balanced object/array from surrounding prose, remove JavaScript comments, convert single-quoted strings, quote unquoted object keys, replace recognized JavaScript/Python literals (True/False become true/false; None, NaN, undefined, and ±Infinity become null), add leading zeros to bare decimal numbers, close unterminated property strings, insert missing commas and closing brackets, remove trailing commas or a final semicolon, and escape raw controls inside strings. Every applied change appears in the report; extraction, semantic literal replacement, structural insertion (missing commas/brackets, closed strings), and excluded JSON Lines records lower confidence from high to medium so they receive extra scrutiny.
Partial salvage is destructive: invalid JSON Lines records are never discarded silently. Without explicit opt-in, one invalid record blocks the result. With opt-in, the report identifies every excluded line. Mismatched brackets and structure that cannot be resolved safely are rejected; within JSON Lines, a record that would need bracket insertion or extraction is treated as invalid rather than repaired.
Inputs normalized for the pipeline
| Input format | JSON normalization |
|---|---|
| JSON, JSONC-style data, JavaScript object-style data | Validated or repaired into JSON with a change report. |
| JSON Lines / NDJSON | Validated or repaired record by record and retained as an array for transformation. |
| CSV | Parsed into an array of JSON objects. |
| YAML | Parsed and normalized to compatible JSON values. |
| TOML | Parsed and normalized to a JSON object. |
| XML or RSS/Atom feed | Converted to CodePrettify’s ordered JSON representation. |
Build a transformation pipeline
After choosing Use result in Transform, the guided workspace shows the recipe builder beside a Live result. Common transformations are one-click choices under Add a transformation; less common choices stay under More transformations. Each step includes a plain-language summary, and Field controls suggest fields detected in the current data with their types and sample values. Labels, helper text, fields, and actions follow the same compact form scale used by other CodePrettify dialogs. Move steps up or down to change the result, remove individual steps, or choose Clear all. The most recent pipeline recipe is retained locally, while the source document itself is never modified.
An incomplete step does not empty or damage the preview: the previous valid result remains visible and the status explains which field or value is still needed. If a completed step removes every row, a prominent No rows matched explanation identifies that step and offers to remove it.
| Operation | What it does |
|---|---|
| Filter rows | Keeps array rows matching equality, comparison, text/array containment, prefix/suffix, or existence conditions. A nested-array field matches when any nested item satisfies the condition; is not equal to matches only when every nested item differs. |
| Select fields | Creates a smaller object from one or more comma-separated paths. Each kept value is stored under the final path segment (customer.address.city becomes city), so choose paths with distinct final names. |
| Remove fields | Deletes one or more selected paths from copied records. |
| Rename field | Moves a value from a source path to a new target path. |
| Sort rows | Sorts an array by a path in ascending or descending order while preserving equal-value order. Null values sort last regardless of direction. |
| Unique rows | Keeps the first row for each distinct path value, or each distinct full row when no path is supplied. |
| Flatten array field | Expands an array-valued field into separate copied rows; rows whose field is not an array pass through unchanged. |
| Group and aggregate | Groups by a path and calculates Count, Sum, Average, Minimum, or Maximum from an optional value path. Non-numeric values are ignored; Average, Minimum, and Maximum over no numeric values yield null. |
| Limit rows | Returns a count of rows after an optional offset. |
In most cases, choose a detected field instead of writing a path. In Filter, the label any item represents an array wildcard — owners[].name checks the name of every item in owners — and Filter also accepts the forgiving form owners.name, crossing the array automatically; other operations expect a concrete path. Advanced paths use familiar dot/index notation such as customer.address.city, items[0].sku, or $["odd.key"]. Filter values accept JSON literals such as true, 42, null, arrays, and objects; other text remains a string. Use "" to match an empty string.
Use Copy, Export, or Open as document when the live output is ready. Opening the result creates a separate document or tab; it does not replace the source.
Safety limits
Fail-closed safeguards: input is limited to 10 Mi characters, output to 20 Mi characters, structure to 250,000 nodes and 512 nesting levels, pipelines to 32 steps, and array output to 250,000 rows. Unsafe integers, lossy or non-finite numbers, overflowing aggregations, and prototype-sensitive path segments are rejected. Limits cannot be bypassed by partial-record salvage.
Copy and Export
Copy
The floating copy menu and app Edit menu offer Original, Formatted, and Minified when valid. The main Copy button and Ctrl+Alt+C reuse your last-chosen variant; before any choice they copy the visible representation (Raw copies Original, Prettified copies Formatted). Feedback explicitly identifies what was copied. YAML hides Minified because there is no safe equivalent.
Export
- Download Original, Formatted, or Minified source.
- Export compatible structured data as CSV or the active table as HTML. CSV files use CRLF line endings, quote every cell, and neutralize formula-leading text for safe opening in spreadsheets; the extension additionally prepends a UTF-8 byte-order mark for Excel.
- Convert compatible documents to JSON/YAML/TOML during download; only targets the document can actually be serialized into are offered, while CSV export shows a readiness status with a reason when unavailable. XML/feed tabular projection is best-effort and can be lossy.
- In the extension, export code as a PNG using visible viewport/full code, line-number, wrap, and resolution choices; when a full-code image is too large for a single PNG, it downloads a ZIP containing numbered PNG parts instead. The Windows app’s Save as Image captures the visible viewport as a single PNG.
The Windows app’s Save writes to disk; Export creates a separate representation. In the extension, export always downloads a new file.
Compare
Compare any two sources
- Open Compare or press Ctrl+Alt+D.
- The left input starts with the current document and the right input starts empty. Edit or paste either side; each side has its own Use current document and Clear controls.
- Use Swap sides before comparing to exchange the actual inputs. Semantic mode is selected automatically when both inputs parse as a supported structured format (the toggle appears only when semantic comparison is possible); switch to Text mode for exact line changes. Semantic availability is detected from the two inputs, not from the open file.
- After comparing, use Swap Sides or Edit inputs; the Windows app also has Previous/Next difference buttons. (After a comparison, Swap flips only which side is displayed without changing the inputs.) Text mode synchronizes pane scrolling, and in the Windows app it adds an Ignore whitespace option that disregards all whitespace inside lines.
Semantic comparison supports JSON/JSONC/JSON Lines/YAML/TOML where parsing succeeds, even if the active document is JavaScript, CSS, or another format. It ignores formatting and object-key order. (JSONC comments and trailing commas inside JSON Lines records are accepted in the app; the extension requires strict JSON per line.) Arrays whose elements are all objects with a unique primitive id, _id, uuid, or guid — the same key on both sides — are matched by identity; all other arrays are compared positionally. Change sets are capped at 5,000 entries, with a trailing … on the counters when truncated, and invalid inputs fall back to text. Very large text comparisons (over roughly 5,000 combined lines in the extension, 20,000 in the app) use a faster position-based comparison that can overstate changes when lines shift. A structured change can jump to an editor line only while the corresponding left or right source still exactly matches the current document, and only for JSON documents with positionally addressed changes — changes inside identity-matched array elements list the change without a jump; independently pasted or edited text never produces a misleading jump. When the sources are identical, both modes show a centered no-differences message over the result area.
Compare files (app)
The Windows app can browse two files, prefill the current file, remember the pair, and open a dedicated comparison tab. Selecting exactly two supported files in Explorer can expose the Compare command.
JavaScript Playground
- Start the Playground from any viewer’s More Actions menu or the extension launcher. Open a JavaScript, JSON, or JSON Lines document first if you want to include it as context.
- Write scratch code. Optionally include the current document; JSON/JSON Lines becomes
const json(invalid JSON Lines records are skipped, and an invalid JSON document provides nojsonvariable). Scratch code and your timeout/include choices are remembered between sessions. - For JavaScript choose Safe definitions to expose callable/passive top-level declarations without page startup, or Run entire file to include startup logic. Safe definitions keeps functions and constants with side-effect-free initializers; classes and values computed at startup require Run entire file.
- Choose a 1, 5, or 15-second timeout and Run, or press Ctrl+Enter.
- Inspect console output,
console.table, errors with mapped lines, duration, and the final expression’s value. Top-levelawaitis supported, and unhandled promise rejections appear as console errors.
Output bounds: the console keeps the last 500 entries, value previews truncate at 10,000 characters, and a timeout hard-terminates the worker so runaway loops cannot linger.
window, document, page libraries, extension APIs, local-file access, fetch, XHR, WebSocket, or other network channel. Node.js APIs are unavailable: require returns a stub module that raises a guided SandboxCapabilityError when used, and referencing process, Buffer, or other CommonJS globals raises the same error. ES module files run with import/export neutralized — imported symbols become undefined or empty stubs — so code depending on imported modules will not behave as it does in its real environment. Browser- or Node-dependent files are expected to fail; isolate a pure function or use Safe definitions.Inspect Runtime
Inspect Runtime executes the current JavaScript in the same sandbox with a fixed five-second timeout and groups top-level variables, functions, and classes. It captures parameter signatures, bounded values, source previews, console output, and declaration line links. Partial results remain useful if later startup code throws.
Choose inline-value display to add captured values beside source lines and hover details. Use Clear inline values to remove annotations. Runtime Inspect has the same no-DOM, no-Node, no-local-files, and no-network restrictions as the Playground.
Regex Playground
- Choose Current document or Custom text. Custom text is session-only; document mode highlights matches in the viewer and can jump to them, and moving the editor cursor onto a highlighted match selects it and shows its capture groups.
- Enter the pattern without surrounding slashes. Toggle global
g(on by default), ignore casei, multilinem, dot-alls, Unicodeu, or stickyy. - Review the matches with line/column. The list shows the first 100 (all matches up to 500 are still counted and highlighted); select a match to see its numbered and named capture groups in the details panel. The right side always shows the complete
/pattern/flagsform with Copy Regex. - Open Advanced for replacement preview (
$1and$<name>), a combined saved-and-recent list holding the last ten patterns (recent runs are recorded automatically; Save pattern adds a named entry to the same ten-slot list), and up to 20 test assertions: Matches, No match, Match count, or Replace equals. - Copy generated JavaScript, C#, or PowerShell snippets, or load an example from the guide.
Safety: patterns run only in a worker, time out after roughly 1.5 seconds, and stop after 500 matches. This prevents a catastrophic expression from freezing the viewer.
In-depth guide: See live named-group matches, replacement preview, tests, and language snippets in Regex Playground.
HTTP Client
Build a request
- Choose GET, POST, PUT, PATCH, DELETE, HEAD, or OPTIONS; enter an HTTP/HTTPS URL and timeout (default 30 seconds).
- Add query parameters, headers, and authentication: None, Bearer, Basic, or API key in a header/query.
- For a body choose None, JSON, raw text, URL-encoded form, multipart fields, or GraphQL with variables. GET and HEAD requests never send a body.
- Use
{{variable}}from an environment. Secret fields are masked in the UI. - Press Send. This is the moment the browser/app makes the external request. While the request runs, Send shows a spinner and a Cancel button appears beside it.
Reuse and share safely
Save requests, collections, environments, and sanitized history. Import cURL or CodePrettify JSON; export JSON. Generate copyable cURL, fetch(), or PowerShell — generated snippets and response views mask known secret values as ******, so re-insert real credentials before running a snippet. Export warns when authentication/secrets would be written in plain text.
Inspect the response
Review formatted Body, Raw, Headers, Cookies, status, duration/timing, size, and content type. The Body tab formats recognized JSON, JSON Lines, YAML, CSS, HTML, XML, JavaScript, or TypeScript in the embedded viewer; use the Raw tab’s Copy button for the exact response text.
Limits and behavior: URLs with embedded credentials are refused (the extension explains this directly; the app reports it as a blocked request) — use the Auth controls instead. Cache is disabled and redirects are followed. Response bodies are capped at 50 MiB; anything beyond the cap is discarded and the size chip shows the bytes actually kept. Requests follow each platform’s fetch rules: in Chrome/Edge the extension’s granted host permissions usually exempt its requests from CORS, in Firefox CORS applies unless host access is granted, and the Windows app is subject to standard CORS. A timeout of 0 disables timeout; maximum differs by product (five minutes in the extension, ten in the app).
Local storage is bounded: the extension allows up to 500 collection entries, 50 environments, and 200 variables per environment; the app uses 100 entries, 20 environments, and 50 variables per environment. History keeps the last 10 requests per page (the extension retains the 25 most recent pages, the app 40). In the extension, history strips credentials, sensitive headers/query values, request bodies, and secret text in error messages before replay data is stored; in the app, history masks well-known credential header values but retains request bodies and query strings, so clear it manually after sending sensitive requests.
In-depth guide: Follow a complete request from params and environment values through formatted body, headers, timing, and copyable snippets in HTTP Client.
Settings
Appearance
Auto/Light/Dark theme and 10–24px editor font. Auto follows the operating system.
Editor
Line numbers, word wrap, minimap, floating toolbar, and two- or four-space indentation.
Language
Auto plus English, Danish, German, Spanish, French, Italian, Japanese, Korean, Norwegian, Portuguese, Russian, Swedish, Vietnamese, and Chinese.
Per-format
Enable per type (extension only) and default view (both products), JSON breadcrumb/click inspector/folding, JS folding/bracket matching, CSS color picker, and XML/RSS folding/clickable URLs. The app also has HTML folding/URLs and a YAML “Enabled by default” toggle.
App startup
Restore the previous session. Desktop settings apply to every open/new tab and remain local to the app.
Extension settings apply immediately and are stored through browser storage; app settings are local. They are not synchronized between products.
Inputs, dropdowns, textareas, buttons, and icon buttons throughout CodePrettify use the same small, medium, and large control scale, so padding, type size, field height, and click targets remain consistent when moving between Settings and tools. Technical textareas in Compare, JSON to Code Generator, JSON Repair & Transform, Data Converter, Schema Validator, HTTP Client, Regex, the JavaScript Playground fallback, and JSON decode all use one compact 13px code-text scale and monospace stack. Modal titles, section headings, field labels, help text, and status messages also share one typography system. Task-specific layouts, state colors, badges, editor viewport heights, and result panes remain specialized where their purpose requires it.
Large files, encoding, and line endings
Native large-file mode
Files of 64 MiB or more use a read-only native pager instead of loading the full WebView document. Generic pages contain about 750,000 characters; CSV pages contain 500 rows with a synchronized raw view. Previous/Next, page search, forward cross-page search with progress/cancel/wrap, and Go to line/row remain available. Most WebView tools are disabled and Save becomes Save As of the original.
Encoding
The app detects UTF-8/BOM, UTF-16 LE/BE, UTF-32 BOM, BOM-less UTF-16 heuristics, strict UTF-8, then Windows legacy fallback. Click encoding in the status bar to reopen as Auto, UTF-8, UTF-8 BOM, UTF-16 LE/BE, Windows-1252, or ISO-8859-1. Overrides are session-only; a reopened file reverts to auto-detection.
Line endings
The status bar shows Windows (CRLF), Unix (LF), Mac (CR), Mixed EOL, or No EOL. Click it to convert the document (files up to 256 MiB). Conversion asks for confirmation and then rewrites the file on disk immediately — no separate save is needed.
Explorer integration and runtime requirements
The packaged x64/Arm64 app is .NET 10 self-contained, so the main app does not require a separate .NET desktop runtime. It does require the shared Microsoft Edge WebView2 Evergreen runtime; if missing, the recovery screen opens Microsoft’s installer and provides Retry.
File associations and Explorer commands can open supported files, and selecting exactly two supported files can offer Compare. This optional Explorer handler is framework-dependent and may require matching Microsoft.NETCore.App 10.x. Use Help > Explorer Integration Runtime to check/install the official prerequisite, then restart Explorer or sign out if the shell has not refreshed.
Keyboard shortcuts
| Action | Shortcut | Availability |
|---|---|---|
| Toggle Prettified/Raw or Rendered/Source | Ctrl+B | Both |
| Copy active/default representation | Ctrl+Alt+C | Both |
| Find | Ctrl+F | Both, Prettified/Rendered view |
| Go to Line | Ctrl+G | Both (extension: Prettified view only) |
| Toggle floating toolbar | Ctrl+Alt+T | Both |
| Open Compare (two editable sources; the left side starts with the current document) | Ctrl+Alt+D | Both |
| JavaScript Playground | Ctrl+Alt+P | Both (app: JS/JSON/JSON Lines documents; the menu entry works everywhere) |
| Inspect Runtime | Ctrl+Alt+I | Both, JavaScript |
| Regex Playground | Ctrl+Alt+R | Both |
| Command Palette | Ctrl+Shift+P | Both |
| Run the open dialog’s primary action (Playground, Schema Validator, Compare, JSON to Code) | Ctrl+Enter | When the dialog is open |
| Close dialog / clear search highlight | Esc | Both |
| Paste & Prettify | Ctrl+N | App |
| Open | Ctrl+O | App |
| Save / Save As | Ctrl+S / Ctrl+Shift+S | App |
| Close tab | Ctrl+W | App |
| Next tab | Ctrl+Tab or Ctrl+Page Down | App |
| Previous tab | Ctrl+Shift+Tab or Ctrl+Page Up | App |
Privacy and security
- Formatting, validation, conversion, diagram generation, JSON-to-code inference and generation, JSON Repair & Transform, statistics, search, comparison, schema checks, security scanning, and playground/regex processing stay on the device.
- The HTTP Client is the intentional network exception: the request is sent directly to the displayed target only after you press Send. CodePrettify does not proxy it.
- Playground and Runtime Inspect run in a Web Worker inside a script-only sandboxed frame whose content-security policy forbids all network connections; fetch, XHR, WebSocket, and other networking primitives are additionally disabled before your code runs, and there is no page DOM, extension API, local-file, or Node capability.
- Markdown suppresses automatic remote image loading. Remote JSON Schema references are never fetched.
- To repair garbled legacy-encoded JavaScript/TypeScript documents, the extension may automatically re-download the same document URL it is already viewing; this request goes only to the server that served the page. Launcher sample documents are loaded from prettify.cloud.
- HTTP environments and saved authentication are local but not encrypted as a secrets vault. Treat exported HTTP JSON as sensitive because it may contain plaintext secrets.
- Extension host permissions allow CodePrettify to recognize supported resources; they do not upload documents.
For the complete policy and marketplace disclosures, read the Privacy Policy.
Troubleshooting
The extension did not activate
Confirm the file type is enabled, reload the raw resource, and check that it is a supported raw document rather than an HTML page. The extension never takes over pages the server delivers as HTML, even for .json or .md URLs: activation needs either a supported response content type, or a supported URL extension while the browser is showing its plain raw-text view. For direct local URLs, enable Allow access to file URLs; alternatively use the launcher picker.
Formatting failed or looks unchanged
Open the validation alert and jump to its line/column. Some formats intentionally preserve text when reserialization could change meaning: YAML, mixed-content XML, and high-precision TOML are common examples.
A tool is missing or disabled
Tools are format- and view-sensitive. Open More Actions/Command Palette, switch from Raw/native view to Prettified, and verify the current data shape. The extension’s Document Navigator is intentionally limited to JSON, JavaScript/TypeScript, and XML/RSS.
The JavaScript file needs document, fs, or fetch
That code cannot run in the secure worker; the failure is reported as a SandboxCapabilityError or a network-disabled error naming the blocked capability. Use Safe definitions and call a pure function, paste an isolated function into the scratchpad, or test it in its intended browser/Node environment.
An HTTP request fails
Verify resolved variables, authentication placement, URL, timeout, and response size. The extension remains subject to browser CORS and credential restrictions. Use generated cURL/PowerShell to compare outside the browser.
A conversion option is disabled
The compatibility check has proven the current input is unsuitable. Read the reason: common causes are invalid JSON, nested data for CSV/TSV, unsafe JSON numbers, invalid UTF-8 Base64, or a lossy YAML/XML construct.
Repair & Salvage refuses the input
JSON Repair & Transform only returns a result when it can produce bounded, safely representable JSON. Review missing brackets or separators, truncated records, unsafe numbers, and nesting/size limits. Enable partial JSON Lines salvage only when excluding the reported broken records is acceptable.
The Windows app will not show its viewer
The main package includes .NET 10, but Microsoft Edge WebView2 Evergreen is required. Use the recovery screen to install WebView2 and Retry. Explorer integration is optional and may separately require Microsoft.NETCore.App 10.x.
