1. #1
    Sencha User
    Join Date
    Feb 2012
    Posts
    78
    Vote Rating
    0
    alfa19 is on a distinguished road

      0  

    Default Parsing data into JSON

    Parsing data into JSON


    Hi,

    i've a form containing 2 fieldset. Every fieldset have these fields:

    - author
    - title
    - date

    if i do this:

    PHP Code:
    Ext.JSON.encodeValue(form.getValues()), 
    the result is:

    {"author":["a1","a2"],"title":["t1","t2"],date:["d1","d2"]}

    while i want to submit a json like this

    [{"author":"a1","title":"t1","date":"d1"},{"author":"a2","title":"t2","date":"d2"}]

    how can i do?

    thanks a lot

  2. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,197
    Vote Rating
    482
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    Provide a unique name (name: 'author1') to each field.

    Regards,
    Scott.

  3. #3
    Sencha User
    Join Date
    Feb 2012
    Posts
    78
    Vote Rating
    0
    alfa19 is on a distinguished road

      0  

    Default


    of course but than i don't have the inner detail.

    with your solution i have a json like this:

    [{"author1": ["a1","t1","d1"],"author2":["a2","t2","d2"]}

    and it is different from:

    [{"author":"a1","title":"t1","date":"d1"},{"author":"a2","title":"t2","date":"d2"}]

  4. #4
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,197
    Vote Rating
    482
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    Please show the code for your form.

    Scott.

Thread Participants: 1