The LocalOnly Blog
Practical, in-depth guides for every tool in the toolkit - the how, the why, and the best practices. Written for developers, and 100% aligned with our privacy-first approach: everything runs in your browser.
JSON Tools
Browse toolsHow to Format JSON Files Automatically with Prettier
Two formatters can disagree about the same JSON file. Here is how a team picks one, applies it in every editor and before every commit, and makes CI enforce it.
Minified vs Pretty JSON: When Minifying Matters
Whitespace in JSON is nearly free once gzip runs. Here is where JSON travels without compression, with the extra bytes measured on sample payloads.
JSON with Comments: JSON vs JSONC vs JSON5 Explained
The same file opens cleanly in VS Code and is rejected by npm. The difference is which of three JSON dialects each tool reads.
Pretty Print JSON in the Terminal, Python and Node.js
Four ways to make JSON readable without leaving your terminal or browser, and the three edge cases where pretty printing changes the data.
JSON Key Order: Why It Changes and How to Sort JSON Keys
The same data can be written with its keys in a different order in each language, and sometimes on each run. Here is where the order comes from, and the fix for each case.
How to Flatten Nested JSON in JavaScript and Python
A recursive function of about ten lines flattens any JSON document into path keys. Here it is for JavaScript and Python, with the choices that decide whether you can rebuild the original.
How to Unflatten JSON: Dot Notation to Nested Objects
Turning user.address.city back into nested objects takes about fifteen lines. Here is a version that builds arrays, fails clearly on conflicting keys and ignores __proto__.
How to Escape JSON for HTML, SQL, Shell Commands and CSV
JSON escaping makes text safe inside JSON. Putting the JSON somewhere else needs that place's own escaping too. Here are the five places it goes wrong most often.
How to Unescape JSON Strings in Logs with jq
When a log line holds an object as an escaped string, you cannot search it by field. Here is how to read it today with jq, and the one-line change that stops it.
JSON.stringify Explained: undefined, Dates and BigInt
Most surprises from JSON.stringify are silent: a field disappears, a Map becomes {}, a date turns into a string. Here is exactly what happens to each kind of value, and how to control it.
Remove Null Values from JSON in JavaScript and Python
A JSON.stringify replacer removes most nulls but not all of them. Here is a tested recursive function for JavaScript and Python, and the one case where removing nulls breaks things.
Empty Array vs Null vs Missing Field in JSON APIs
Leaving out empty arrays saves a few bytes and costs every client a defensive check. Here is how to decide what an API should return, and how to write it into the contract.
How to Compare Two JSON Objects in JavaScript and Python
JSON.stringify(a) === JSON.stringify(b) fails as soon as key order differs. Here is how to check equality properly in JavaScript and Python, and how to list exactly what changed.
How to Deep Merge JSON Objects in JavaScript and Python
The built-in ways to combine objects lose nested settings. Here is a short, tested deep merge for JavaScript and Python, and how to handle arrays, null and __proto__.
How to Open Large JSON Files Without Crashing Your Editor
Loading a 121 MB JSON file took over a gigabyte of memory in jq. Streaming the same file took 3 MB. Here is how to explore large JSON without loading it all at once.
How to Measure JSON Size: Characters, Bytes and Gzip
A payload can be 19,847 characters, 20,197 bytes and 1,803 bytes on the wire, all at once. Here is which number an API limit, a database or a browser actually checks.
JSONPath vs jq vs JMESPath: Syntax Compared with Examples
Three query languages for JSON look alike and behave differently. Here are ten everyday queries in all three, with the results they actually return.
JSON Schema to TypeScript and Pydantic: Generate Types
A JSON Schema can generate the types your code uses, so the contract and the code cannot drift apart. Here is the output of two common generators, tested on one schema.
How to Validate JSON Request Bodies with JSON Schema
Checking a request body against a JSON Schema replaces dozens of hand-written if statements. Here is a tested setup for Node and Python, and a 400 response that tells the client exactly what to fix.
Converters
Browse toolsJSON vs YAML for Config Files: Which Should You Use?
YAML is easier to read and easier to get wrong. Here is what each format gives you for configuration, the mistakes YAML lets through, and a rule for choosing.
How to Convert YAML to JSON in JavaScript (Node.js)
Two lines of code convert YAML to JSON, and the parser's defaults decide whether merge keys apply, dates stay strings and no means false. Here are the options that matter, tested.
How to Convert JSON to CSV in JavaScript and Python
Joining values with commas breaks on the first name that contains one. Here is a short, tested JSON to CSV converter for JavaScript and Python, and the details that make Excel open it correctly.
How to Convert CSV to JSON in JavaScript and Python
A single quoted comma breaks the split approach. Here is correct CSV parsing in Python and JavaScript, the byte order mark that renames your first column, and safe type conversion.
How to Convert JSON to XML in JavaScript and Python
A library escapes the text for you, but it will happily write XML that is not valid. Here is tested JSON to XML code for Node and Python, and the three inputs that break it.
How to Convert XML to JSON in JavaScript and Python
A default XML parser drops attributes, turns 007 into 7 and returns an object or an array depending on how many items there are. Here are the settings that fix all three.
Developer Utilities
Browse toolsHow to Generate a UUID in JavaScript, Python and SQL
Every modern runtime can generate a UUID without a library. Here are the one-liners for JavaScript, Python and PostgreSQL, a tested UUID v7 function, and two common mistakes.
Nano ID vs UUID vs Auto-Increment IDs Compared
Every new table and every public URL needs an ID scheme. Here is how Nano ID, UUID and auto-increment compare, with the collision maths worked out and a tested Nano ID function.
What Is Base64 Used For? Data URIs, Auth, JWT, Email
Base64 turns bytes into plain text so they can travel where only text is allowed. Here are the five places developers meet it most, with real examples, and the cases where it is the wrong tool.
Decode Base64 in the Terminal, JavaScript and Python
Decoding Base64 is one call in every language, and each call has a trap: atob garbles accents, Buffer accepts junk, and Python rejects missing padding. Here is the correct version of each.
How to Verify a JWT in Node.js and Python
Decoding a JWT shows its claims; verifying it proves they are genuine. Here are the checks a correct verification makes, written out in Node.js and Python so you can see each step.
URL Encoding Characters: What to Encode and Where
The same character can be fine in one part of a URL and break another. Here is a reference table of what each JavaScript and Python function does with the characters that matter.
How to Decode a URL Parameter That Contains Another URL
Tracking links and login redirects nest one URL inside another, encoded once per layer. Here is how to unwrap them correctly in JavaScript and Python, and the redirect check that keeps it safe.
Check a File's SHA-256 Hash on Mac, Linux and Windows
A published SHA-256 checksum only helps if you compare it. Here are the exact commands for each operating system, a one-step check against a checksum file, and code for Node.js and Python.
NIST Password Guidelines: The Rules to Use in Your App
NIST's guidance dropped the rules most sign-up forms still enforce. Here is what it recommends instead, why length beats symbols in numbers, and how to generate passwords securely in code.
Unix Timestamp vs ISO 8601: How to Store Dates
JSON has no date type, so every API picks a format for dates. Here is how Unix timestamps and ISO 8601 strings compare, the bugs each one invites, and what to use where.
Lorem Ipsum Alternatives: Realistic Test Text
Lorem ipsum has short, even words, so it hides the layout bugs real content exposes. Here is a set of test strings worth keeping next to it, and the CSS that keeps them from breaking a layout.
PlantUML vs Mermaid: Which Diagram Tool Should You Use?
Both turn plain text into diagrams, and both are free. They differ in which diagrams they draw well, where they render without extra setup, and where your diagram source goes. Here is how to choose.