I have a basic HTML form looking like this:
<html>
<form id="myform" action="something.cgi" method="post">
<select name="Container">
<option>container 1</option>
<option>container 2</option>
</select>
<input name="element1" type="text">
<!-- ... -->
</html>
My aim is the let the user do some configuration and save it to a config file where I can read it from another application. I'm looking for a method to create a JSON string like this
{
"Container 1":
{
"Group 1":
{
"element1": "value1",
"element2": "value2"
}
"Group 2":
{
"element3": "value3",
"element4": "value4"
}
}
}
I read this POST data in JSON format but using the JSON.stringify method returns something like:
{
"Container": "Container 1",
"element1": "value1",
"element2": "value2",
"element3": "value3",
"element4": "value4",
}
I'm wondering if there is a standard way of doing this? Thanks for help!