View Full Version : How to post back data as nested JSON

22 May 2009, 11:12 PM

I need help on how to post back data as nested JSON. My app has a grid using store which calls a form for editing. When data is loaded on my app it is a nested JSON just like below ( i just shortened the data) :

"row": {
"Id": "1",
"Name": "John",
"Email": "[email protected]",
"Address": {
"Id": "1"
"Line1": "Line 1",
"Line2": "Line2",
"CIty": "City"


Here's the Ext.data.Record constructor that provides mapping for JSON object

var FacilityRecord = Ext.data.Record.create([
{ name: 'Address.Id' },
{ name: 'Address.Line1' },
{ name: 'Address.Line2' },
{ name: 'Address.City' }

"row" is the root of the data

But when it is posted back to the server, it flattens out the data. It will now look :

"row": {
"Id": "1",
"Name": "John",
"Email": "[email protected]",
"Address.Id": 1,
"Address.Line1": "Line 1",
"Address.Line2": "Line2",
"Address.CIty": "City"


I need help on how to post back data but it still maintains the JSON data hierarchy.

Thanks in advance for the help.

6 May 2010, 6:59 PM
That was my problem too in DWR. What I did is convert it first to JSON string, using Ext.encode(json), then decode it in the server using json-simple