Codieren binary data into a JSON-safe string
Konvertieren raw bytes (images, encrypted blobs, file contents) into a Base64 string that can be embedded inside a JSON field without breaking the structure.
- 1
JSON cannot carry raw bytes — all string values must be valid Unicode. Base64 encodes arbitrary bytes into ASCII letters, digits, and +/ which are all JSON-safe, making it the standard way to embed binary payloads.
- 2 Base64-Kodierer →
Paste or upload the binary data. The tool outputs a Base64 string with no line breaks, ready to paste as a JSON string value.
- 3 json-format → base64-encode → url-encode
When the JSON containing the Base64 field must itself go into a URL, use this chain: it Base64-encodes the binary, wraps it in JSON, and percent-encodes the result.
- 4 JSON-Formatierer →
Umbrechen the Base64 string in a JSON object like {"data":"<base64>","type":"image/png"} and format it to verify the structure is valid.
Häufige Fragen
- Why not use hex instead of Base64 for JSON?
- Hex works but doubles the size (2 chars per byte vs Base64's 1.33). For large binaries the size difference matters; Base64 is the conventional choice for JSON-embedded binary.
- How do I include the MIME type?
- Store it as a sibling field (e.g. "mimeType":"image/png") or build a data URI (data:image/png;base64,<...>). The data URI form lets browsers render it directly in an <img> tag.