I currently only care about integers and arrays to be reliably parsed.
- JSON in querystring isn't very much seen, and I feel it is not compact. URL always have length limits.
- I also have seen GraphQL in URL.
- Single-lined YAML?
- If I don't use querystring format, what about the keys?
_=
?
Top comments (3)
The conventional option is of course application/x-www-form-urlencoded, but ...
LOL.
That said if the API is public it is probably still best to use the most widely supported format, application/x-www-form-urlencoded.
If the API is private however, no one is gonna stop you from throwing your data in a MessagePack and Base65536 encode it.
EDIT: Base65536 is actually not denser than Base64 octet-wise. Just use Base64 is probably fine.
If you still want it to be readable, maybe jsurl?
Both JSON and YAML are heavily url-encoded.
I ended up with Rison, which only encode strings (to single quotes
'string'
) if needed. Also, arrays are!(a,1)
, instead of["a",1]
.But indeed, I know that the original Rison project is dead. 😢
FYI, there is a better maintained fork: github.com/w33ble/rison-node