[erlang-questions] url query string encode/decode

Roger Lipscombe roger@REDACTED
Fri Dec 15 14:15:00 CET 2017


If you control both ends, I wouldn't bother with query strings. I'd
just post JSON. You can nest stuff as much as you want then. Be
careful to change strings (lists of chars) to binaries, though.

On 15 December 2017 at 13:09, Caragea Silviu <silviu.cpp@REDACTED> wrote:
> Thx Roger,
>
> I'm using hackney_url but I did some small changes to be able to encode
> proplists with nested structures. As time as you also pointed out I didn't
> found any standard and also in my case I'm the one that encodes and also the
> one that decodes being an internal service.
>
> What I did is in case the value is a proplist or a list encoded it as json.
> I saw this approch in some other public services as well
>
> Silviu
>
> On Fri, Dec 15, 2017 at 1:39 PM, Roger Lipscombe <roger@REDACTED>
> wrote:
>>
>> On 15 December 2017 at 10:55, Caragea Silviu <silviu.cpp@REDACTED> wrote:
>> > Seems parsing of lists is not compliant.
>>
>> There's no standard to be "compliant" with. Everyone pretty much
>> agrees on key-value pairs where the keys are unique. Beyond that, who
>> knows? I've seen ?a=1&a=2&a=3 and ?a[]=1&a[]=2&a[]=3, for instance.
>> See, e.g., https://stackoverflow.com/q/24059773/8446.
>>
>> fwiw, I tend to build my URLs with hackney_url. I don't know what it
>> does with repeated keys; I've never tried.
>
>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>



More information about the erlang-questions mailing list