try:
payload = json.loads(decoded["payload"])
except ValueError as e:
raise DecodeError(f"Invalid payload string: {e}")
if not isinstance(payload, dict):
raise DecodeError("Invalid payload string: must be a json object")
return payload
This code fails if the payload is an array.
I'm very new to JWT are valid array JSON not supported as payload?
Summary.
This code fails if the payload is an array.
I'm very new to JWT are valid array JSON not supported as payload?
Based on the debugger here https://jwt.io/#debugger-io?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.W3sic3ViIjoiMTIzNDU2Nzg5MCIsIm5hbWUiOiJKb2huIERvZSIsImlhdCI6MTUxNjIzOTAyMn1d.UWfiOz3NZMDUv5T4lw65EhF0lWOTkRVx6izjV4QkXfo it would say that they are?
Expected Result
I would expect to be able to encode and decode JSON arrays in addition to the regular dict
Actual Result
The code only checks for dict