I am creating dynamic input
and textarea
. Each package has an input and a textarea
. and the user can create a maximum of 10.
I want to get the result of input
and textarea
as JSON but I can’t get it the way I want and I don’t know how to improve from this point.
The current JSON output is like this;
[
{"name":"textbox2","value":"test #1"},
{"name":"textareabox2","value":"test-textarea #1"},
{"name":"textbox2","value":"test #2"},
{"name":"textareabox2","value":"test-textarea #2"},
{"name":"textbox3","value":"test #3"},
{"name":"textareabox3","value":"test-textarea #3"}
]
What I want should be like this, How can I convert it to this? like this:
[
{'input':'test #1', 'textarea' :'test-textarea #1'},
{'input':'test #2', 'textarea' :'test-textarea #2'},
{'input':'test #3', 'textarea' :'test-textarea #3'}
]