I’m looking for a library or pair of libraries that handles conversion to and from some kind of URL & human friendly encoding for simple structs. Specifically I have query parameters I want to submit to an API and I don’t want to have to build the translation from struct to URL and URL back to struct by hand for each bit of data query config. Currently I’m sending URL-escaped JSON which works well enough for programmatically generated requests but is a pain if you want to build URLs by hand.
I’d like to make it easier without having to support multiple encoding formats.
I’m familiar with schema and the recently released form which handle processing path-based URL encoded data and storing it into a struct. I’ve also seen urlvalues that was put together to generate schema
-compatible URLs from a struct but each of these are problematic or incomplete solutions.
-
schema
doesn’t support nested slices as far as I can tell (bug) and doesn’t have any built-in approach to encoding structs into a format it can consume (feature request) -
urlvalues
is the basis for the solution for #44 above but based on my initial tests doesn’t handle structs or slices out of the box -
form
does great on the decode side but there doesn’t seem to be an encoding solution
If the answer is “write the features you need” that’s fine I just don’t want to duplicate that work if there is already a good solution or set of solutions out there and would appreciate any pointers.
cheers!