Nested JWT token claims

Viewed 880

Just a quick question regarding the JWT spec and common JWT best practices. Can / should I use nested objects as JWT token claims or should I used prefixed claims? It both seems to be valid (at least it is both decoded by websites like https://jwt.io) but I am unsure if there are guidelines on which of the two options to choose.

Option 1:

{
  "iat": 1516239022,
  "user.firstName": "John",
  "user.lastName": "Doe"
}

Option 2:

{
  "iat": 1516239022,
  "user": {
    "firstName": "John",
    "lastName": "Doe"
  }
}
0 Answers
Related