PDA

View Full Version : sending a nested json obj as a param to the server



kdipika
21 Jun 2013, 1:23 PM
Hi,

Currently we have a form as in the screenshot and the data we send to the backend on form submit looks like this





user:{"id":155446503,"activeFlag":false,"userName":"2","firstName":"1","lastName":"1","securityQuestion":null,"securityAnswer":"","phoneNumber":"1-111-111-1111-1111","emailAddress":"tc@tc.com","encryptedPassword":"","password_confirm":"","securityId":null,"managerId":null}


but i want to send this data in the nested json format to the server like this one.
user : {
details : {
firstname : "abac",
lastname : "xyz"
},
contacts : {
email : "abc@xyz.com",
address : "something.."
}
}

How can we achieve this.Please help.

Thanks In Advance.

slemmon
23 Jun 2013, 9:41 PM
Try doing:



form.submit({
params: Ext.decode(formPanel.getValues());
});