1. #1
    Sencha User
    Join Date
    Jul 2012
    Location
    Arlington, VA
    Posts
    14
    Vote Rating
    0
    varunet is on a distinguished road

      0  

    Default Unanswered: Processing JSON Object to List

    Unanswered: Processing JSON Object to List


    Hi,

    I have the following format of JSON object, it is a list of objects (but not in an array). Is it possible transpose this object "projects" to a list? or if I have to do any preprocessing before the data is applied to the list, where do I do it?

    Any link to Tutorial would be helpful.

    Code:
    {    "rows": "3",
        "os": "0",
        "page": "1",
        "total": "78",
        "projects": {
            "115565": {
                "id": "P115565",
                "status": "Active",
                "project_name": "Additional Financing ",
                "countryshortname": "Nigeria"
            },
            "001122": {
                "id": "001122",
                "status": "Closed",
                "project_name": "Water Supply Project",
                "countryshortname": "Cote d'Ivoire"
            },
            "004148": {
                "id": "004148",
                "status": "Closed",
                "project_name": "Juam Regional Project",
                "countryshortname": "Korea, Republic of"
            }
        }
    }
    and as usuall... I do not have any control over the JSON object.


    Thank you for your help

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    35,677
    Answers
    3355
    Vote Rating
    749
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Your server should respond with an array, that is the most optimized way to do this.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    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 in print!

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

  3. #3
    Sencha User
    Join Date
    Jul 2012
    Location
    Arlington, VA
    Posts
    14
    Vote Rating
    0
    varunet is on a distinguished road

      0  

    Default


    Thank you, mitchellsimoens.

    Well, I noticed that there were other problems with the search server. It was returning JSON in text format and did not support callbacks. So I had to write a proxy in PHP in any case.

    And I did some string manupulation (I believe it is the worst way to fix the issue) on the response to get the following result. It works fine now.

    Code:
    {
        "rows": 25,
        "os": "25",
        "page": "2",
        "total": "29",
        "projects": [{
            "id": "113463",
            "status": "Dropped",
            "project_name": "PUBLIC FINANCIAL MANAGEMENT -2",
            "countryshortname": "Angola"
        }, {
            "id": "122700",
            "status": "Pipeline",
            "project_name": "Learning for All Project",
            "countryshortname": "Angola"
        }, {
            "id": "050280",
            "status": "Dropped",
            "project_name": "Luanda Water Supply Project",
            "countryshortname": "Angola"
        }, {
            "id": "060512",
            "status": "Dropped",
            "project_name": "Water Sector Development Project",
            "countryshortname": "Angola"
        }]
    }
    Let me know if you recommend anything else. Thank you.

Thread Participants: 1

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar