1

I am an android developer, i am new to windows phone development. I want to Parse a Json data form a URL the data may change as for the User Input this is my Json data

{
"request": "ok",
"query": {
    "result": [
        {
            "site": [
                {
                    "latest": [
                        {
                            "id": "2eaQy8Ow",
                            "data": "1/1/2014"
                        }
                    ],
                    "url": "http://www.shopclues.com/"
                }
            ],
            "model": "Nexus 10",
            "height": "8.89",
            "name": "The New Google (Samsung) Nexus 10 10-inch Andriod 4.2 (Jelly Bean) Tablet 16GB SSD 2560x1600 Pixel World Highest Resolution for 300 ppi WQXGA (WiFi Only) 2GB Ram Micro USB Micro HDMI Accelerometer Compass Ambient light Gyroscope Barometer GPS",
            "features": {
                "Hard Drive": "16 GB ssd",
                "Card Description": "GPU: Mali-T604",
                "Processor": "1.70 GHz Exynos 5000 Series"
            },
            "image": [
                "http://www.simplydecoded.com/wp-content/uploads/2013/02/Telangana2.jpg"
            ]
        }
    ]
}
}

To parse this Json in windows Phone 8 (C#), i followed these links

1. To parse json in windows phone 8

2. To Parse json data

But in windows phone Json Parsing some example are showing Given data only so i want it for Dynamic data

So my problem is that i already prepared a Android Application which looks like this this which is there in android.

So i want to prepare the same process in windows But its taking Only one Constant It should change dynamically..

Whats Going On
  • 1,379
  • 6
  • 20
  • 49
  • hi user2967727, you can follow the second link to display an image and json data form a URL. –  Jan 14 '14 at 06:49
  • yes User3124880 But when i follows that technique I am getting only one Output i want it for dynamic... there should be some other technique to parse Json SO i am thinking on that way in android i have n. number of ways to parse JSON – Whats Going On Jan 14 '14 at 06:55

2 Answers2

2

If i understood you correctly, you want to: 1) Get data 2) Deserialize 3) Make ListBox automatticaly display info

You have to: 1) Create clases: You can use json2CSharp.com or just in VS2012 Edit-Paste-Paste Special - As JSON classes 2) In XAML write listBox items template with bindings to propertiec in your JSON classes ( anither big but WERY useful thing to learn ). 3) Deserialize JSON into the Top class object and then just do listbox.ItmesSource = and point to your array with deserialized data

You will bing images to URL and they will get downloaded and displayed automatically.

Developer
  • 4,158
  • 5
  • 34
  • 66
  • Yes Cheese Sir, But This is My Development Process But i want How to Use these all together as i done in android I am asking for a example which may be for a Sample data also no problem.. I have a Huge data to pare I am just asking Example links or tutorials so that i can make same like android application – Whats Going On Jan 14 '14 at 06:53
  • Hello Cheese, If we Do this Process We will Get only One Response IT shoud Be Dynamic.. –  Jan 14 '14 at 07:02
  • http://stackoverflow.com/questions/8738031/deserializing-json-using-json-net-with-dynamic-data There is an applied answer on this, and seems logical =) – Developer Jan 14 '14 at 07:53
  • Thanks for Update Cheese.. But this helped me Up to 30% Thanks for the Process I need exact Answer But I am Marking this as Answer.. I am tied of waiting.. Thanks for the Response Cheese.. And some people Even they Don't know answer They will Flag this question But you are Given me a Responce Thank you.. Hey please Up vote my question... – Whats Going On Jan 14 '14 at 08:04
2

I had a similar problem in my project when parsing Dynamic json

I Converted json string to Jtoken(Newtonsoft.Json)

JToken configToken = JObject.Parse(response); 

and then querying the required data using child and grandchild

Here i am querying the data 'VAT' which is inside tags 'data/userManagedFields' in the Json

 var VatList = configToken["data"]["userManagedFields"]["VAT"];
        List<double> vatList = new List<double>();

        foreach (JToken child in VatList.Children())
        {
            foreach (JToken grandChild in child)
            {
                vatList.Add((Convert.ToDouble(grandChild.ToString()) * 100));                    
            }
        }

Hope this will help you.

Jagath Murali
  • 515
  • 3
  • 13