Results 1 to 8 of 8

Thread: json encode/decode

  1. #1
    Ext User
    Join Date
    Mar 2007
    Posts
    218
    Vote Rating
    0
      0  

    Default json encode/decode

    hey guys!

    question: how do i encode e.g. an array to json-notation? and how decode?

    ive tried this, but it aint worl:

    Code:
    var formDataArray = new Array(textfield_username, textfield_password);
    return this.encode(formDataArray);
    what i want to do is, i want to encode some form data to json in javascript, give it to serverside php with ajax, and then create and php-object by decode in php. is this possible, did anybody have done somethink like this before?

    regards
    humpdi

  2. #2
    Ext User
    Join Date
    Mar 2007
    Posts
    218
    Vote Rating
    0
      0  

    Default

    ok sorry, ive found out how to do:

    Code:
    Ext.util.JSON.encode(formDataArray)

  3. #3
    Ext User
    Join Date
    Mar 2007
    Posts
    218
    Vote Rating
    0
      0  

    Default

    ok, second question: :-P


    i want my json-object/string to look like this:

    Code:
    {"METHOD":"save_user", "OBJECT":[{"User":[{"username":"humpdi", "password":"xyzabc"}]}]}

    how should my code should look like, if i want such a result?


    please help!

  4. #4
    Ext User
    Join Date
    Mar 2007
    Posts
    218
    Vote Rating
    0
      0  

    Default

    ok, again ive found out on my own how to do this.. although thank you all for your help

    that shows me that sometimes its much better to invest more time in self-searching then in forum posting.. you could learn much more

    thanks

  5. #5
    Ext User
    Join Date
    May 2008
    Posts
    13
    Vote Rating
    0
      0  

    Default json

    Can you please explain how did you achieve the solution?

    Thank you very much

  6. #6
    Ext User
    Join Date
    Jul 2007
    Location
    Florida
    Posts
    9,996
    Vote Rating
    8
      0  

    Default

    There's several examples of this around the forums. What part are you looking for specifically? You can check example in my signature and also look on www.extjs.eu

  7. #7
    Sencha User luisparada's Avatar
    Join Date
    Nov 2007
    Location
    Venezuela
    Posts
    95
    Vote Rating
    2
      0  

    Default

    Hello, I have the same problem with this, can you please post the link to view the solutions?
    Thanks
    ____________________________________
    do not make install, just compile it.!!!
    --------------------------------------------------
    //*************k4m1k4z3************\\

  8. #8
    Ext User
    Join Date
    Jun 2009
    Posts
    10
    Vote Rating
    0
      0  

    Default Humpdi can i ask ur advice

    Since u figured the problem with the array encoding and now i hit the same .. an u please advise me also on how ??? to solve it? thankx

Similar Threads

  1. Why Ext.util.JSON.encode breaks when reach an html entity?
    By kimu in forum Ext 2.x: Help & Discussion
    Replies: 3
    Last Post: 27 Mar 2007, 7:18 AM
  2. Replies: 2
    Last Post: 6 Mar 2007, 12:33 PM
  3. JSON encode bug
    By harish in forum Ext 1.x: Bugs
    Replies: 6
    Last Post: 8 Feb 2007, 4:37 AM
  4. YAHOO.ext.util.JSON.encode() infinite loop on CustomEvents
    By kalebwalton in forum Ext 1.x: Bugs
    Replies: 2
    Last Post: 20 Dec 2006, 3:32 PM
  5. YAHOO.ext.util.JSON.encode typo
    By ericwaldheim in forum Ext 1.x: Bugs
    Replies: 1
    Last Post: 7 Nov 2006, 6:55 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •