How to Convert Go Struct Debug Output (%+v / %#v) to JSON
Go's fmt.Printf %+v and %#v output looks structured but isn't JSON. Learn how to convert Go struct, map, and slice debug output to valid JSON.
Tips, guides and tutorials for developers
Go's fmt.Printf %+v and %#v output looks structured but isn't JSON. Learn how to convert Go struct, map, and slice debug output to valid JSON.
PHP's print_r, var_dump, and var_export produce human-readable output that isn't JSON. Learn how to convert all 3 formats — plus serialize() — to valid JSON.
Rust's #[derive(Debug)] output looks structured but isn't JSON. Learn how to convert Debug trait output — structs, enums, Vec, HashMap — to valid JSON.
Understand the three parts of a JWT token — Header, Payload, and Signature. Learn how JWT authentication works, common security mistakes, and how to debug tokens.
Compare UUID (v4/v7), ULID, and NanoID — their formats, sortability, collision probability, and database performance. A practical guide to choosing the right ID.
Master cron expressions — learn the 5-field format, special characters, 10 most common patterns, and pitfalls across Linux, Kubernetes, GitHub Actions, and Spring.
Complete guide to converting MySQL CREATE TABLE to Go structs — type mapping, NULL handling with pointers, naming conventions, struct tags, and the DECIMAL precision problem.
Master Go struct tags — json, db, gorm, validate, bson, yaml. Learn the syntax, common options, combining multiple tags, and the most frequent mistakes.
Master Go's if err != nil pattern — learn the 4 common error handling styles, best practices for error wrapping with fmt.Errorf, and how to automate boilerplate.
Master go-playground/validator tags — learn the most used rules (required, min, max, oneof, email), common mistakes, and how to test your tags before deploying.
Developers encounter broken JSON daily — from Python dicts to Java Map output. Learn how to identify and fix the 5 most common non-standard JSON formats.
Learn why Python dict output isn't valid JSON, the 5 key differences between them, and how to convert Python dict strings to proper JSON quickly.
Java's Map.toString() output looks like JSON but isn't. Learn 3 approaches to convert {key=value} format to valid JSON, including handling nested maps.
JSON5 extends JSON with comments, trailing commas, unquoted keys, and more. Learn what JSON5 adds, where it's used, and how to convert between JSON5 and JSON.
Learn practical techniques to extract and fix JSON buried in log files — from grep and regex approaches to handling broken JSON with nested brackets.