1. #1
    Sencha User
    Join Date
    Jun 2012
    Posts
    4
    Vote Rating
    0
    prmondal is on a distinguished road

      0  

    Default Unanswered: Parsing Nested Json

    Unanswered: Parsing Nested Json


    I am getting a response in nested JSON format from the server which is below:

    Code:
    {
       "Feedback":[
          {
             
             "Question":"question1",
             "Answers":[
                {
                   "Answer":"answer1",
                   "AId":1
                },
                {
                   "Answer":"answer2",
                   "AId":2
                }
             ],
             "QuestionId":1
          },
          {
              "Question":"question2",
             "Answers":[
                {
                   "Answer":"answer3",
                   "AId":3
                },
                {
                   "Answer":"answer4",
                   "AId":4
                },
               {
                   "Answer":"answer5",
                   "AId":5
                }
             ],
             "QuestionId":2
          }
       ]
    }
    The above JSON is dynamic which means the number of answers for each question may vary.
    How can I parse this JSON and display answers in a combo box correspond to each question?

    Please help.

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,714
    Vote Rating
    436
    Answers
    3113
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    Are you using associations?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Jun 2012
    Posts
    4
    Vote Rating
    0
    prmondal is on a distinguished road

      0  

    Default


    Can you give some examples for associations?