I am trying to take data from a form and send it to remote server :
The code is:
<html>
    <head>
        <script src="http://code.jquery.com/jquery-latest.min.js"></script>
    </head>
    <body>
<h2>Create Sensor</h2>
<form id="form">
<form enctype='application/json'>
  <input name='version' value='1.0.1'>
  <input name='sensors[0][sensor]' value=''>
  <input name='sensors[0][output][0][name]' value=''>
  <input name='sensors[0][output][0][type]' value=''>
  <br>
            <input id="input" type="submit" name="submit" value="Create Sensor" />
</form>
        <script>
            $.ajaxSetup({
                contentType: "application/json; charset=utf-8",
                dataType: "json"
            });
            $(document).ready(function() {
                $('#input').click(function() {
                    var send = $("#form");
                    $.ajax({
                        url: "http://posttestserver.com/post.php",
                        type: "POST",
                        data: send,
                        success: function (sreg, status, jqXHR) {
                        alert(JSON.stringify(sreg));
                            },
                            error: function (jqXHR, status) {
                                alert(JSON.stringify(jqXHR));
                            }
                    });
                    return false;
                });
            });
        </script>
    </body>
</html>
But the JSON is not properly formed as I am returning by alert. Can anyone please help me out? I am not good at coding just trying to learn
This is the expected JSON:
{
    "version": "1.0.1",
    "sensors": [
        {
            "sensor": "",
            "output": [
                {
                    "name": "",
                     "type": ""
                }
            ]
        }
    ]
}
Another query is : is there any online platform through which I can get expected JSON by inputing JSON form like this? Please help me out
 
    