I have some client side javascript posting data to my web.py server
that looks like this:

     $.ajax({
        type        : 'POST',
        url         : '/graph/',
        dataType    : 'json',
        data        : {nodes: [{pie:1, cake:2}]},  //temporary data
for testing output
        success     : function(data){
          console.log(data);
        }
      });

When my server receives the POST, and I have some code that looks
something like this:

class graph:
    def POST(self):
        graph1 =  web.data()
        graph2 = web.input()
        print graph1
        print graph2

Then my output looks like

graph1 :  nodes%5B0%5D%5Bpie%5D=1&nodes%5B0%5D%5Bcake%5D=2
graph2:   <Storage {'nodes[0][cake]': u'2', 'nodes': {}, 'nodes[0]
[pie]': u'1'}>

What I want to happen of course is for the data posted to be
deserialized so that my python dictionary has the same structure as it
did in javascript.  However, web.input seems to flatten the whole
thing, and web.data encodes it in some form that I can't do anything
with.  Now I'm sure I'm bastardizing some web standards by trying to
do what I'm doing, but is there anything I can do to keep web.py from
flattening/encoding it funky?  Or another way to get the result I
want?

Thank you.

-- 
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/webpy?hl=en.

Reply via email to