44 chars · 1 line
Needs attention
44 chars · 1 line
Needs attention
JWT header JSON error
A JWT header can decode from Base64URL into syntactically valid JSON and still be unusable when the top level is an array, null, string, or number. This decoder requires an object because JOSE header parameters such as alg, typ, and kid are represented as named object members. This tool is free to use. No account or payment is required.
Last updated
The example below decodes to ["HS256"]. JSON.parse can read that value, but there is no alg member for the decoder to inspect because array positions are not JWT header parameter names.
Malformed JSON can also fail here, but an object-shape failure is different: decoding and JSON syntax both succeed before the decoder rejects the top-level value.
The first segment is valid Base64URL and valid JSON, but the decoded array cannot represent named JWT header parameters.
["HS256"]{"alg":"HS256","typ":"JWT"}Common questions
No for this decoder. JWT header parameters are read from a JSON object whose member names identify parameters such as alg, typ, or kid.
JSON validity only proves the text has legal JSON syntax. The decoder separately requires the parsed top-level value to be a non-null object and rejects arrays and scalar values.
No. A parseable header only exposes metadata such as alg; signature, issuer, audience, and authorization checks still belong to a trusted JWT verifier.
Debugging a specific JWT issue? Browse JWT troubleshooting.