How to change the form data into json and pass to api using post method?
===

    Id:<input type="text" id="id" required="required"></br>
    Name:<input type="text" id="name" required="required"></br>
    <input type="submit" id="submit">
I have a form, where i have placed the above code. And now i can give values. What i need is, i have to send the value that i give in the text box to an api in a specific format as shown below.

    { "entry":
          { "id":"",
            "name":""
          }
    } 

I have to do it using ruby. I am not using rails or any other framework. How can i do this? If possible give me some code examples.