Skip to content
Discussion options

You must be logged in to vote

There are multiple approach, a simple one would be to have a hidden input with the value being JSON.stringify(object) and then in your action do JSON.parse(formData.get("that input name"))

Another approach is to name your inputs like object["key"], then use await request.text() to get a string of the whole request body and use a library like qs to parse the string (which is gonna a search param string) to an object and that lib can parse your input names to objects so your input with the example key would be like { object: { key: "the value" } ], you could even use arrays this way.

Replies: 1 comment 7 replies

Comment options

You must be logged in to vote
7 replies
@lili21
Comment options

@jgb-solutions
Comment options

@ianhernandez
Comment options

@sergiodxa
Comment options

@eltitano
Comment options

Answer selected by MichaelDeBoey
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants