Overview
Introduction
UBJSON's binary, type-tagged bytes are efficient for machines to parse but opaque to read directly, especially when you're debugging an embedded system's output or a custom UBJSON packer.
This tool decodes hex-encoded UBJSON back into readable JSON so you can verify what a given byte sequence actually represents.
What Is UBJSON to JSON Converter?
A UBJSON decoder that reads a hex-encoded byte sequence's type markers (S for string, various integer types, [ / { for containers) and reconstructs the equivalent JSON value.
It targets UBJSON's basic container format, matching the output of the site's JSON to UBJSON Converter, rather than the optimized (strongly-typed) container variant.
How UBJSON to JSON Converter Works
The decoder converts the hex text into raw bytes, then reads one type marker at a time, dispatching to the right decoding logic (fixed-width read for numbers, length-prefixed read for strings, recursive element reads for [ arrays and { objects) based on that marker.
Container types are recognized by their ] or } terminator byte, so the decoder knows exactly when to stop reading elements and return to the parent container.
When To Use UBJSON to JSON Converter
Use it when you have a UBJSON hex dump, from an embedded system, a game save file format, or the JSON to UBJSON Converter, and need to see what JSON value it decodes to.
It's also useful for verifying a custom UBJSON encoder's output is correct by comparing the decoded JSON against what you expected.
Often used alongside JSON to UBJSON Converter, BSON to JSON Converter and MessagePack to JSON Converter.
Features
Advantages
- Decodes every integer width UBJSON defines (int8 through int64) transparently into a single JSON number type.
- Reports a specific error location for malformed or truncated input instead of failing silently.
- Runs entirely client-side, so no data being decoded ever leaves the browser.
Limitations
- Only reads UBJSON's basic container format, not the optimized (strongly-typed, fixed-length) variant some encoders produce.
- Expects hex-encoded input, not an uploaded raw binary .ubj file.
Examples
Best Practices & Notes
Best Practices
- Use the exact hex output from JSON to UBJSON Converter when testing the pair, to avoid an invalid or unsupported type marker.
- Strip formatting like 0x prefixes or commas from a copied hex dump before pasting, the decoder expects plain space-separated hex pairs.
- If a document from another UBJSON implementation fails to decode, check whether it uses the optimized container format, which this decoder doesn't read.
Developer Notes
The decoder advances a byte cursor strictly according to each type marker's known width or explicit length prefix (never scanning for delimiters), which mirrors how the basic UBJSON container format is actually structured: fully self-describing byte-by-byte with no separate index or schema to consult.
UBJSON to JSON Converter Use Cases
- Inspecting UBJSON output from an embedded system or game save format as readable JSON
- Verifying a custom UBJSON encoder's output round-trips to the expected JSON
- Debugging a UBJSON-based binary protocol by decoding captured byte sequences
Common Mistakes
- Pasting an optimized-format UBJSON container's bytes, which use a different, unsupported layout.
- Including non-hex formatting characters in the pasted input, which breaks the byte-pair parsing.
- Expecting a raw binary .ubj file upload to work directly instead of its hex representation.
Tips
- Pair with JSON to UBJSON afterward to confirm decoding round-trips correctly.
- When a decode fails partway through, check the byte immediately before the failure point first, most errors trace back to a wrong type marker or length prefix there.