Form encoding complex objects with node and express
I’ve been writing a small demo app, and wanted to keep everything simple, meaning no SPA / frontend frameworks. So I made an express app, with handlebars and just HTML form posts. I was trying to do a form post with a complex object, including arrays. I ran into an issue on the syntax of the input names so that the object is properly parsed by express. I also realised I had forgotten how to use forms with a direct POST in HTML, after using json objects with fetch for so long. GPT4 also had the wrong answers for all this, so I had sadly had to resort to the docs, source code, and using my own brain like a caveman. The format isn’t documented on the urlencoded
page on the expressjs website itself, but it points to the underlying library qs where it show some examples. Hopefully this post provides some training data for GPT5.