# MessagePack to JSON

Paste MessagePack hex or base64 and decode it into pretty-printed JSON. Preserves field order, uint64 values, timestamps, and binary payloads in your browser.

## Run it

- **CLI:** `gizza tool msgpack-to-json "82a7636f6d70616374c3a6736368656d6100"`
- **Web:** https://gizza.ai/tools/msgpack-to-json/
- **Agents:** machine-readable descriptor (parameters JSON Schema) at https://gizza.ai/tools/msgpack-to-json/tool.json

## Inputs

- `input` — MessagePack bytes (hex or base64) _(field)_
- `input_format` — Input encoding _(field)_
- `indent` — Indent (spaces, 0 = minify) _(field)_
- `binary_format` — Binary / ext encoding in output _(field)_

## Output

- Decoded JSON (text)

## Query parameters

Open the tool pre-filled and auto-run via URL:

- `input` — MessagePack bytes (hex or base64)
- `input_format` — Input encoding
- `indent` — Indent (spaces, 0 = minify)
- `binary_format` — Binary / ext encoding in output

Example: `https://gizza.ai/tools/msgpack-to-json/?input=82a7636f6d70616374c3a6736368656d6100&input_format=auto&indent=2&binary_format=base64`

---

## About this tool

Paste a [MessagePack](https://msgpack.org/) blob as **hex** or **base64** and this
tool decodes it into readable, pretty-printed JSON. MessagePack is a compact
binary serialization format used in caches (Redis), network protocols, config
blobs, and driver payloads — great for machines, hard to read by eye. This
decoder turns those bytes back into JSON you can inspect.

Field and element **order is preserved** (MessagePack maps are ordered), and full
**uint64 precision** is kept, so a 64-bit id is not silently rounded to a float.
Choose the indent, or set it to `0` to minify to one line. Everything runs
locally in your browser using WebAssembly; the bytes are never uploaded.

MessagePack has a few types JSON cannot hold natively, so they are shown by a
small, documented convention:

- Raw binary (`bin`) → a base64 (default) or hex **string** of the bytes.
- Extension (`ext`) → `{ "$ext": <type>, "data": "<base64|hex>" }`.
- The reserved **timestamp** extension (type -1) → an RFC 3339 / ISO 8601 UTC
  string.
- Non-string map keys (numbers, booleans, nil) → stringified keys.

### Worked example

The hex blob `82a7636f6d70616374c3a6736368656d6100` is the canonical MessagePack
sample `{ "compact": true, "schema": 0 }`. With **Input encoding** set to `hex`
and **Indent** set to `2`, the result is:

```json
{
  "compact": true,
  "schema": 0
}
```

Set **Indent** to `0` and the same input minifies to one line:

```json
{"compact":true,"schema":0}
```

### Limits and edge cases

- Input is a hex or base64 **string**, not a file upload. To decode a `.msgpack`
  file, base64- or hex-encode it first (for example `base64 file.msgpack`) and
  paste the text.
- Several MessagePack values concatenated back-to-back are returned as a JSON
  array, in order.
- Non-finite floats (NaN, Infinity) are rendered as `null`, since JSON has no way
  to represent them.

## FAQ

<!-- FAQ MUST be <details>/<summary> accordions. -->

<details>
<summary>What input formats does this accept?</summary>

Paste the MessagePack bytes as a **hex** or **base64** string. With **Input
encoding** left on `auto`, the tool detects which one you pasted; force it with
`hex` or `base64` if the encoding is ambiguous. Hex input may include spaces,
`:`, `-`, or `,` separators and `0x` markers — they are ignored — so byte dumps
paste cleanly.

</details>

<details>
<summary>How are binary and extension types handled?</summary>

JSON has no binary type, so raw `bin` values and unknown `ext` payloads are
encoded as a **string**. Use the **Binary / ext encoding** option to pick
`base64` (default) or `hex`. An unknown extension becomes
`{ "$ext": <type>, "data": "<encoded>" }`, and the reserved timestamp extension
(type -1) is decoded to an ISO 8601 UTC string like `2018-01-01T00:00:00Z`.

</details>

<details>
<summary>Does it keep full precision for large integers?</summary>

Yes. A 64-bit unsigned integer such as `18446744073709551615` (`u64::MAX`) is
preserved exactly instead of being rounded to a floating-point number. Map key
order is preserved too, so the JSON reflects the original document structure.

</details>

<details>
<summary>Is my data uploaded anywhere?</summary>

No. The decoder is compiled to WebAssembly and runs entirely in your browser
tab. The MessagePack bytes you paste never leave your device, and there is no
sign-up or request to a server.

</details>

## Related tools

- [Amazon Order Analyzer](https://gizza.ai/tools/amazon-order-analyzer/): Paste an Amazon order-history CSV export to summarize total spend by month, top items, and category breakdowns. Browser-only, private, with Markdown or JSON output.
- [Avro to JSON Converter](https://gizza.ai/tools/avro-to-json/): Decode Apache Avro Object Container Files (.avro / OCF) to JSON, NDJSON, or the embedded schema — no .avsc needed, free and private in your browser.
- [Reconcile bank statement and ledger CSVs](https://gizza.ai/tools/bank-statement-reconcile/): Match bank-statement CSV rows to ledger rows by date, signed amount, and fuzzy memo similarity, with unmatched and suggested matches.
- [Bencode decoder](https://gizza.ai/tools/bencode-decoder/): Decode bencode (the BitTorrent / .torrent serialization format) into readable JSON, and re-encode JSON back into canonical bencode — in your browser. Nothing is uploaded.
- [Budget Planner](https://gizza.ai/tools/budget-planner/): Plan a monthly budget from take-home pay: 50/30/20 needs/wants/savings targets with custom splits, or a zero-based plan showing what's left to allocate.
