Reputation: 2630
It's useful to add custom HTTP header to provide application specific metadata or information to client, and hoping one day it can be a standard like link header (Web Linking).
Most of HTTP headers are designed under RFC 2616 specification with char, : | < | > | ; | = | " | ' |, etc. It's more close to human readable string than machine readable (easy to parse or not).
Now, I want to add a custom HTTP header to contain a structure information, which is easy to represent in object format like JSON object. Is it OK to add a custom HTTP header which it's value is a serialized JSON object or I should follow the convention to reformat it into some kind format like link header?
Hoping you guys can provide some advices on this, or other best practices to do it.
Thanks.
Upvotes: 1
Views: 1543
Reputation: 42017
If you need JSON, use JSON. Be sure to get non-ASCII characters right, though.
Upvotes: 1