How to create toggles and text boxes from a object which contains id and name. And how to get those values after form submission

My Object is :
let obj = {‘textbox’:[{‘id’:1,‘name’:‘FirstName’},{‘id’:2,‘name’:‘LastName’}],‘toggle’:[{‘id’:1,‘name’:‘Car’},{‘id’:2,‘name’:‘Bus’}]}

if i selected Cars and Bus then i have to get those two toggle id’s and i have to send those to toggle options and textbox values with id to web service after form submission.