Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/artemeff/qsp
Enhanced query string parser for Erlang
https://github.com/artemeff/qsp
Last synced: 3 days ago
JSON representation
Enhanced query string parser for Erlang
- Host: GitHub
- URL: https://github.com/artemeff/qsp
- Owner: artemeff
- License: mit
- Created: 2014-08-27T18:16:38.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2016-10-30T09:57:36.000Z (about 8 years ago)
- Last Synced: 2024-10-06T23:46:25.546Z (about 1 month ago)
- Language: Erlang
- Size: 7.81 KB
- Stars: 19
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
- awesome-erlang - qsp - Enhanced query string parser for Erlang. (Text and Numbers)
README
### qsp [![Build Status](https://secure.travis-ci.org/artemeff/qsp.png)](http://travis-ci.org/artemeff/qsp)
---
QSP is enhanced Erlang query string parser, that supports nested arrays, hashes and returns maps. Requires Erlang 17.0 and better. Extracted from [Plug](https://github.com/elixir-lang/plug/blob/master/lib/plug/conn/query.ex).
---
```erlang
> qsp:decode(<<"foo=bar">>).
#{<<"foo">> => <<"bar">>}
> qsp:decode(<<"foo[]=bar&foo[]=baz">>).
#{<<"foo">> => [<<"bar">>,<<"baz">>]}
> qsp:decode(<<"foo[bar]=baz&foo[rab]=zab">>).
#{<<"foo">> => #{<<"bar">> => <<"baz">>,<<"rab">> => <<"zab">>}}
> qsp:decode(<<"foo[][bar][][baz][]=1">>).
#{<<"foo">> => [#{<<"bar">> => [#{<<"baz">> => [<<"1">>]}]}]}
> qsp:decode(<<"foo=1&foo=2">>).
#{<<"foo">> => <<"2">>}
```---
### Contributing
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request