View Full Version : MApping nested joson data to formpanel

20 May 2012, 11:41 AM
Formpanel and json nested data -> external reader?


I am trying to fill a formpanel with 'nested' json data:

{ "success": "true", "data": { "properties": { "id": "1094", "title": "In1" }, "values": { "courier_subject": "suj1" } } }
(this is an extract, but the full json has been validated with jsonlint).
How to map this to form name field . values.corier_subject is not working.

Can some one help me how to map above scenario in extjs4

20 May 2012, 11:25 PM
Hi raghs,

"values" is not correct config to set field value( use "value" config)
You can also try this code to combine your nested json data into single object and fill your form panel field.
call loadRecords() after success

loadRecords: function(data){
var combineData = {};
for (var prop in data){
Ext.apply(combineData, data[prop]);

your form panel.setValues(combineData);

Sword-it Istanbul

21 May 2012, 8:21 AM
Thanks for you reply,, My requirement is like this.

Class Person {
String name;
Address addr;
... }
Calss Address {


and my json object is based on Person class that is it includes the nested object Address. How to map this Person form bean to extjs formpanel.

Thanks in advance

4 Mar 2013, 9:28 AM
Did you ever get an answer to this? How did you work around it?