◆ Recipe · 2 steps
Clean JSON for an API payload
Validate a JSON payload, format it, then Base64-encode it for a header or a worker.
Why this recipe exists. A broken tweak to an API fixture is expensive. This chain catches the syntax error before the payload ships, then hands you the encoded form other systems expect.
01 Sequence
The steps
Each step is a live tool. Open it, do the work, then send the result on.
-
Encode the compact JSON for a header or an environment variable.
Send result carries this value to the next step.
02 Proof
A real run
Run by hand in a browser — the same input and output you get here.
Input Value
Starting input
{"project":"astra","live":true,"tools":5} Step 1 · JSON Formatter
{
"project": "astra",
"live": true,
"tools": 5
}
Step 2 · Base64 Encoder & Decoder
ewogICJwcm9qZWN0IjogImFzdHJhIiwKICAibGl2ZSI6IHRydWUsCiAgInRvb2xzIjogNQp9
03 Edges
If it breaks
One concrete edge case per step.
- JSON Formatter: A trailing comma or a single-quoted key fails the parse; the error names the exact line and column so you fix it before encoding.
- Base64 Encoder & Decoder: Decoding a value that still carries = padding together with a stray space is rejected — strip the whitespace and try again.