Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.

Timeline for Send an Array with an HTTP Get

Current License: CC BY-SA 3.0

13 events
when toggle format what by license comment
Mar 17, 2021 at 8:54 comment added BalusC As answered, "That depends on what the target server accepts. There is no definitive standard for this".
Mar 17, 2021 at 2:11 comment added Ryabinin Sergey this approach: foo[]=value1&foo[]=value2&foo[]=value3 can send an array with indices: foo[1950]=value1&foo[201]=value2&foo[123]=value3 and etc.
Sep 22, 2020 at 22:28 comment added BalusC I'm not saying that the query string carries type information, just that the brackets trigger type information in some server side languages. This happens in e.g. PHP but not in e.g. Java because it has its a separate way to obtain them as an array. If you leave out the brackets, PHP doesn't return an array anymore.
Sep 22, 2020 at 20:24 comment added Martijn Pieters Put differently: the issue is that a query string carries no type information, not that the language parsing the query string is weakly typed. PHP and Ruby do not require the additional brackets to accept multiple values for the same name.
Sep 22, 2020 at 20:11 comment added Martijn Pieters This doesn’t generalise. The brackets is a Ruby on Rails marshalling convention to encode nested structure into an otherwise flat sequence. Zope (Python framework) used a different scheme for the same use case. These schemes have mostly been obsoleted by AJAX and JSON. The idea that this should be generalised to type systems is very far fetched, to be honest.
Sep 22, 2020 at 16:59 comment added BalusC This is indeed unspecified. That's exactly why the answer says "Generally". In strong typed languages the bracket suffixes [] in request parameter names are namely not interpreted the same way as in weak typed languages. It was originally introduced as an internal work around for weak typed languages in order to be able to create the intended variable type. PHP was the first do to so.
Sep 22, 2020 at 16:15 comment added omnomnom what nonsense, language typing has nothing to do with it
May 20, 2020 at 14:14 comment added Akshay Barpute when server uses nodeJs, you can simply pass array as foo=[value1,value2,value3] .When you obtain this inside express route with req.query, you will get {foo:'[value1,value2,value3]'}. You just need to parse it & use this array in your code
May 23, 2017 at 12:10 history edited URL Rewriter Bot
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Aug 13, 2015 at 13:00 history edited BalusC CC BY-SA 3.0
bold important parts
May 19, 2015 at 8:43 history edited BalusC CC BY-SA 3.0
Improved.
Jun 17, 2010 at 12:38 vote accept Matteo
Jun 17, 2010 at 11:40 history answered BalusC CC BY-SA 2.5