Blog
Short answers to the errors and formats developers run into: JSON, XML, CSS units, encoding and privacy.
Why does atob fail with "The string to be decoded is not correctly encoded"?
atob throws 'not correctly encoded' when input isn't plain Base64: URL-safe - and _, a data: prefix, extra = padding or a cut-off string. Fixes for each.
Is Base64 encryption?
Base64 is not encryption. It is a reversible encoding with no key, so anyone can decode it. Use AES for secrets and Argon2id or bcrypt for passwords.
Base64 vs Base64URL: what is the difference?
Base64 vs Base64URL: the URL-safe variant swaps + and / for - and _, and usually drops the = padding. The decoded bytes are the same.
HS256 vs RS256: which JWT algorithm should I use?
HS256 vs RS256: use HS256 when one service signs and verifies its own tokens, and RS256 when other services or third parties must verify them.
What is the alg none attack on JWT?
The JWT alg none attack sets the header alg to none and drops the signature, so a library that trusts the header accepts forged claims.
Why is my JWT expired when the exp time looks right?
A JWT expired error with a correct-looking exp usually means seconds vs milliseconds, clock skew, a timezone bug or nbf. How to find which.
Can a JWT be decoded without the secret?
You can decode a signed JWT without the secret, because its payload is only base64url. Encrypted JWTs (JWE) need the key, and verifying always does.
What is the difference between decoding and verifying a JWT?
JWT decode only reads the header and payload. Verify checks the signature, algorithm, expiry, issuer and audience before you trust the token.
Is it safe to paste a JWT into jwt.io?
jwt.io is safe for test and expired tokens. Keep live production tokens local, and never paste a signing secret into any web debugger.
Where should I store a JWT: localStorage or cookies?
Store a JWT in an HttpOnly, Secure, SameSite cookie, not localStorage. Any XSS bug can read localStorage; JavaScript can't read an HttpOnly cookie.
How do I fix "Converting circular structure to JSON"?
Converting circular structure to JSON means an object points back to itself. Read the error path, then drop, replace or flatten that reference.
How do I decode a JWT safely?
To decode a JWT safely, base64url-decode it locally or in a client-side tool, and never trust the claims until a server verifies the signature.
Why does JSON.stringify return undefined or drop fields?
JSON.stringify returns undefined for functions, symbols and undefined, and drops non-enumerable, symbol-keyed and Map or Set data. Each case and its fix.
What is the difference between JSON.stringify and JSON.parse?
JSON.stringify vs JSON.parse: stringify turns a JavaScript value into a JSON string, parse turns a JSON string back into a value.
How do I store dates in JSON?
JSON has no date type. The safest JSON date format is an ISO 8601 / RFC 3339 string with an explicit time zone, like 1985-04-12T23:20:50.52Z.
What is NDJSON (JSON Lines) and when should I use it?
The NDJSON format, also called JSON Lines, stores one complete JSON value per line. Use it for logs, streams, bulk loads and big exports.
Is it safe to paste JSON into online formatters?
An online JSON formatter is safe only if it never sends or saves your input. Check the Network tab, avoid save links, and never paste live secrets.
How do I open a very large JSON file without crashing my browser?
To open a large JSON file safely, don't load it whole: stream it with jq or ijson, pull out a few records, then view those small pieces in a browser.
How do I compare two JSON files and ignore key order?
To compare JSON and ignore key order, sort keys first (jq -S) and diff, or parse both and compare objects in Python or Node, where order doesn't count.
Does JSON key order matter?
JSON key order doesn't change the data: the spec calls objects unordered. It matters for hashes, signatures, diffs and code that reads keys by position.
How do I handle NaN and Infinity in JSON?
JSON has no NaN or Infinity. Send them as null or as strings like "NaN", or raise an error, and set every serializer to the same rule.
How do I pretty print JSON in Python?
Pretty print JSON in Python with json.dumps(data, indent=4), json.dump for files, or python -m json.tool, plus sort_keys and datetime fixes.
How do I display Markdown in HTML?
To display Markdown in HTML, convert it first: with Pandoc at build time, or with marked in the page, then sanitize the result before you insert it.
What is minified JS?
Minified JS is JavaScript with comments, whitespace and long names stripped out so it downloads faster. It runs the same but is hard to read.
How do I pretty print JSON in the terminal with jq?
Pretty print JSON with jq: run jq . file.json or pipe into jq . Use --indent, --tab or -S to sort keys, and save via a temp file, never the input.
How do I use rem in Figma?
To use rem in Figma, open Dev Mode, pick CSS in the Code section and set the unit to rem. Set unit scale changes the base from the 16px default.
How do I convert XML to JSON?
Convert XML to JSON with a library that maps attributes to @ keys and repeated tags to arrays, then force arrays for tags that can appear once.
How do I fix invalid JSON automatically?
Fix invalid JSON automatically with a repair library like jsonrepair, then re-validate and diff it. Quote and comma fixes are safe; truncation isn't.
How do I minify JavaScript?
Minify JavaScript with Terser or esbuild, or let your bundler do it at build time. Ship a source map and watch for code that reads function names.
Are .yaml and .yml files the same?
YAML vs YML: yes, .yaml and .yml hold the same YAML format. Only the extension differs; RFC 9512 lists .yaml as preferred and .yml as still used.
How do I decode Base64 on the Linux or PowerShell command line?
Decode Base64 on the command line with base64 -d on Linux, or [Convert]::FromBase64String plus a text encoding in PowerShell. Errors and fixes.
How do I decode Base64 in Python?
To decode Base64 in Python, call base64.b64decode() to get bytes, then .decode('utf-8') for text. Fixes for padding and URL-safe input.
How do I format JSON in Notepad++?
Notepad++ can't format JSON on its own. Install JSON Viewer or JsonTools from Plugins Admin, then press Ctrl+Alt+Shift+M or Ctrl+Alt+Shift+P to format it.
How do I format JSON in VS Code?
Format JSON in VS Code with Shift+Alt+F (Windows), Shift+Option+F (Mac) or Ctrl+Shift+I (Linux). No extension needed, plus fixes when it does nothing.
How do I convert JSON to CSV?
Pick the array that holds your records, flatten nested objects into dotted columns, and write it with a CSV writer that quotes commas and quotes.
What opens a .json file?
Any text editor can open a JSON file because it is plain text. Use a browser or JSON viewer to read it, VS Code to edit it, Excel to analyze it.
What is the JSON format? Syntax and examples
JSON is a text data format of objects, arrays, strings, numbers, true, false and null. Strict rules: double quotes, no comments, no trailing commas.
What is an XML file and how is it formatted?
An XML file is plain text that stores data in tags you name yourself, with one root element, properly nested tags and quoted attributes.
Why does JSON.parse lose precision on large numbers?
JSON.parse turns every number into a JavaScript double, which holds integers exactly only up to 9007199254740991. Bigger IDs get silently rounded.
JSON vs JSON5 vs JSONC: what is the difference?
JSON is the strict standard. JSONC is JSON plus comments (and often trailing commas). JSON5 adds comments, unquoted keys, single quotes and more.
JSON vs YAML: which should I use for config files?
Use YAML when people edit the config by hand and need comments; use JSON when programs write it or your tool demands it. Quote ambiguous YAML values.
How do I validate JSON against a JSON Schema?
Write a schema, declare its draft with $schema, then run a validator: Ajv in JavaScript, jsonschema in Python, or check-jsonschema on the command line.
Can JSON have comments?
No. Standard JSON has no comment syntax, so // or /* */ makes JSON.parse fail. Use JSONC or JSON5 for config, or strip comments before parsing.
What does "Unexpected end of JSON input" mean?
The parser ran out of text before the JSON was complete. Usually the body was empty: a 204 response, a HEAD request, or a variable that was never filled.
Why does JSON not allow trailing commas?
JSON's grammar only puts a comma between two values, so a comma before ] or } is a syntax error. It stays strict so every parser accepts the same text.
Why does JSON require double quotes?
JSON's grammar defines a string as text between double quote characters, and every key is a string. Single quotes and bare keys are syntax errors.
How to Debug REST API Responses Privately (Without Third-Party Logging)
Learn how client-side JSON formatters process API keys and credentials directly in browser RAM with zero network logging. DevTools verification & GDPR/HIPAA compliance.
How to Unescape Double Backslashes in JSON Strings Instantly
Fix double escaped JSON strings and remove backslashes online. Learn causes of double serialization in REST APIs, cURL, SQL, plus code snippets in JS, Python, and Go.
Client-Side XML to JSON Conversion: The Complete Developer Guide
Understand XML DOM parsing, mapping attributes to JSON keys, handling CDATA, and transforming XML elements into structured JSON objects.
REM to PX Conversion Guide: Reverse Calculating CSS Typography
Reverse calculate REM units to fixed pixels. Formulas, 0.5rem to 3rem reference charts, 62.5% root font trick math, and accessibility best practices.
How to Test Responsive HTML & CSS Layouts In-Browser (No Local Server Needed)
Test HTML markup and CSS breakpoints in isolated srcdoc sandboxes. Preview mobile (375px), tablet (768px), and desktop viewports in browser memory.
URL Encoding vs. HTML Entity Encoding: When & How to Use Each
Master URL percent encoding, HTML entity escaping (<, >, &, "), XSS prevention, and UTF-8 Base64 decoding using zero-server browser tools.
How to Convert JSON to YAML for Kubernetes & Docker Compose
Convert JSON payloads into valid Kubernetes YAML specs and Docker Compose definitions. Avoid tab indentation errors with zero-server client parsing.
JavaScript Minification Best Practices: Shrink Bundle Size & Validate Syntax
Best practices for shrinking JavaScript bundles, validating syntax errors, compressing scripts safely without breaking async/await, and running sandboxed code.