Results 1 to 3 of 3

Thread: Help with Nested List for JSON feed with no Specified Root

  1. #1
    Sencha User
    Join Date
    Mar 2012
    Posts
    5
    Vote Rating
    0
      0  

    Question Help with Nested List for JSON feed with no Specified Root

    Hello Everyone!

    I'm confused as to how to manipulate this data so that I can use it for a nested list. I don't have access to modify the JSON feed. The feed is as such:

    Code:
        "Cars": {
            "order": 1,
            "Brands": {
                "Hyundai": {
                    "model1": "Sonata",
                    "model2": "Elantra"
                },
                "Honda": {
                    "model1": "Accord",
                    "model2": "Civic"
                }
            }
        },
        
        "Trucks": {
            "order": 2,
            "Brands": {
                "Ford": {
                    "model1": "Ranger",
                    "model2": "F-150",
                    "website_url": "www.Ford.com"
                },
                "Jeep": {
                    "type1": "Compass"
                    "type2": "Liberty"
                    "website_url": "www.Jeep.com"
                }
            }
        },
        
        "Bicycles": {
            "order": 4,
            "Types":{
                "Mountain":{
                    "wheel grip": "great"
                },
                "Regular":{
                    "wheel grip": "good"
                }
            }
        }
    This is a feed that I just made which resembles exactlly how the json feed that I'm using is set up. As you can see there is no specified root. Also, "Brands" is the same with Cars and Trucks but not in Bicycles which is "Types". There is also the addition of "website_url" in Trucks which I want to use but is not under Cars. The set up for Bicycles is different but I want it part of the same list.

    Once again, this is a model of the actual feed and I would like "Cars, Trucks, and Bicycles" under the same nested list. I don't really know how to do this and I've been looking through the docs and through the forum for something like this with no luck. Thanks!

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,556
    Answers
    3931
    Vote Rating
    1272
      0  

    Default

    You need to have array of items not an object with multiple keys.
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

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

  3. #3
    Sencha User
    Join Date
    Mar 2012
    Posts
    5
    Vote Rating
    0
      0  

    Default

    Thank you for replying. Is there any way to work around this? I mean is there a way to change the format of json file within Sencha? Is there is a work around or is modifying the actual json file the only feasible solution?

Tags for this Thread

Posting Permissions

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