# How can i capture complete form data into json like as below

**URL:** <https://community.weweb.io/t/how-can-i-capture-complete-form-data-into-json-like-as-below/9556>\
**Category:** How do I?\
**Created:** [July 5, 2024, 9:16am UTC](https://community.weweb.io/t/how-can-i-capture-complete-form-data-into-json-like-as-below/9556 "2024-07-05T09:16:42Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![soumya](https://avatars.discourse-cdn.com/v4/letter/s/ea5d25/32.png) [@soumya](https://community.weweb.io/u/soumya)\
**Post date:** [July 5, 2024, 9:16am UTC](https://community.weweb.io/t/how-can-i-capture-complete-form-data-into-json-like-as-below/9556/1 "2024-07-05T09:16:42Z")

</div>

![image](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/b/bb35f3604af19ec93f4d9e5a73a0b1ccbf4ca4f5.png)  
How can i capture complete form data into json like as below

{“size”:{“type”:“input”,“value”:“123”},“color”:{“type”:“color”,“value”:“123”},“model”:{“type”:“input”,“value”:“123”},“price”:{“type”:“text”,“value”:“123”}}

---

<div class="post-metadata">

**Author:** ![luka](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/luka/32/1571_2.png) [@luka](https://community.weweb.io/u/luka)\
**Post date:** [July 5, 2024, 11:00am UTC](https://community.weweb.io/t/how-can-i-capture-complete-form-data-into-json-like-as-below/9556/2 "2024-07-05T11:00:42Z")

</div>

You make a workflow on Form submit that creates a object in the format that you wish and then you use [JSON.stringify](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify) to correctly paste into text

---

<div class="post-metadata">

**Author:** ![soumya](https://avatars.discourse-cdn.com/v4/letter/s/ea5d25/32.png) [@soumya](https://community.weweb.io/u/soumya)\
**Post date:** [July 5, 2024, 12:00pm UTC](https://community.weweb.io/t/how-can-i-capture-complete-form-data-into-json-like-as-below/9556/3 "2024-07-05T12:00:15Z")

</div>

This is a dynamic form based on the json i am displaying the form fields now i want the same json to be submitted back  
 ![image](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/d/d2f045b2580390f41218fcda08a1f39d9c851aac.png)

---

<div class="post-metadata">

**Author:** ![soumya](https://avatars.discourse-cdn.com/v4/letter/s/ea5d25/32.png) [@soumya](https://community.weweb.io/u/soumya)\
**Post date:** [July 8, 2024, 4:14am UTC](https://community.weweb.io/t/how-can-i-capture-complete-form-data-into-json-like-as-below/9556/4 "2024-07-08T04:14:51Z")

</div>

Sharing few more details could some one help me here

 ![image](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/2/26390a4bfd55d0ff8ac765c58de39c3534917922.png)

I have rendered the form dynamically based on data.json and conditional rendering  
if type==‘input’ then it will display input field  
if type==‘text’ then it will display text field

Now i want to submit the form i need to create a json and submit but am not able to find how can i bind these form fields to variables

Can you Please help me here if anything am doing wrong ?

---

<div class="post-metadata">

**Author:** ![dorilama](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/dorilama/32/10403_2.png) [@dorilama](https://community.weweb.io/u/dorilama)\
**Post date:** [July 8, 2024, 6:26am UTC](https://community.weweb.io/t/how-can-i-capture-complete-form-data-into-json-like-as-below/9556/5 "2024-07-08T06:26:09Z")

</div>

you need to use the “on change” workflow of the inputs to sync the values with a global variable. it’s the same principle of [this example](https://community.weweb.io/t/checkboxes-within-a-collection-list/1379/3) or [this example](https://community.weweb.io/t/checkboxes-within-a-collection-list/1379/3) or [this example with multiple forms](https://community.weweb.io/t/are-form-variables-not-visible-while-the-form-is-in-a-collection-item/1138/6)
