-1

In Windows Phone App.. I am parsing JSON Data By (get,set) method I got another way of processing JSON data from this URL

In the part of this site (http://www.dfg-team.com/json-feeds-on-windows-phone/?lang=en) Is used two techniques to parse json data..

in that I want to use this. Key word for processing JSON data ..

But My app have data Have a Lot of Json data which contains lot of JSON Arrays and JSON Objects. But its not a Problem in that I have main problem is My json contains Json array inside json object or json object inside the json array so at here we got problem.

This is My JSon data I want to parse these fields.. using this. method

{
"returnCode": "success",
"SData": {
    "results": [
        {
            "wdetails": [
                {
                    "noffers": [],
                    "offers_count": 0,
                    "name": "yahoo.com",
                    "recentoffers_count": 0,
                    "sku": "30072826",
                    "url": "http://www.yahoo.com"
                },
                {
                    "noffers": [
                        {
                            "id": "3aggEYoyaso",
                            "price": "179.99",
                            "firstrecorded_at": 13700,
                            "lastrecorded_at": 13700,
                            "seller": "google",
                            "availability": "In stock, ships same Business Day.",
                            "currency": "USD"
                        }
                    ],
                    "offers_count": 1,
                    "name": "frys.com",
                    "recentoffers_count": 1,
                    "sku": "789",
                    "url": "http://www.google.com"
                },
                {
                    "listprice_currency": "USD",
                    "noffers": [
                        {
                            "id": "2SlCKQKm",
                            "price": "192.37",
                            "firstrecorded_at": 111,
                            "lastrecorded_at": 111,
                            "seller": "Amazon",
                            "availability": "13 In Stock",
                            "currency": "USD"
                        }
                    ],
                    "offers_count": 1,
                    "name": "amazon.com",
                    "listprice": "288.56",
                    "recentoffers_count": 1,
                    "sku": "1084089",
                    "url": "http://www.amazon.com"
                }
            ],
            "model": "GGGG",
            "weight": "771107.03",
            "price_currency": "USD",
            "gtins": [
                "00839294"
            ],
            "mpn": "GGGG",
            "cat_id": "25552",
            "height": "98.81",
            "features": {
                "Product Type - General": "Tablet",
                "Height (in.)": "1.70"
            },
            "length": "416.56",
            "geo": [
                "usa"
            ],
            "width": "267.97",
            "category": "Tablets",
            "price": "179.99",
            "updated_at": 138,
            "color": "Black",
            "manufacturer": "google",
            "images_total": 1,
            "images": [
                "https://evbdn.eventbrite.com/s3-s3/eventlogos/1832816/google.png"
            ],
            "brand": "Dell",
            "offers_total": 180
        }
    ],
    "total_results_count": 1,
    "results_count": 1,
    "code": "OK",
    "offset": 0
  }
  }

I want to parse this Using this. in C#.

In Android I done this By hash map method, in Windows Phone this. is similar to is hash map so I am using this..

Cœur
  • 37,241
  • 25
  • 195
  • 267
Whats Going On
  • 1,379
  • 6
  • 20
  • 49
  • 2
    `this.` says "the current instance of the class you are currently writing" that has nothing to do with a hashmap. You Need a JSON Deserialization. – TGlatzer Feb 03 '14 at 08:29
  • 1
    hello Grumbler85 sir, i already done app in android with hashmap.. so i found this. is similar to that hashmap method.. so i want to parse by json data using this. and i want to Deserialize. it.. – Whats Going On Feb 03 '14 at 08:32
  • You did not understand the blog you posted here. Every `this` in the blog-article is just a (redundant) reference to the GUI-class they are using. For deserialization they use Newtonsoft.JSON. – TGlatzer Feb 03 '14 at 08:37
  • 1
    Hope this will help http://stackoverflow.com/questions/20512623/how-to-deserialize-json-with-class-name-as-dynamic-values/21153670#21153670 – Jagath Murali Feb 03 '14 at 08:50
  • 1
    Hi Jagath Murali sir, Its ok sir.. but i don't want to use get,set.. i already tried with foreach process but its,,, not sutable for my json data.. Please help me to solve this JSON arrays and JSON objects in the part of 1st method i mean (this)... Please help sir... – Whats Going On Feb 03 '14 at 10:03

1 Answers1

1

I am editing my previous answer :-

JObject json = JObject.Parse(yourJson);

if you need results to be parsed

this.ClassOfResult=  json ["SData"]["results"];

if you want the 'wdetails' in the Json to get parsed you can try this

this.parentclass.wdetailsClass=  json ["SData"]["results"]["wdetails"];

Hope that this will give you some idea.

Jagath Murali
  • 515
  • 3
  • 13
  • ho.. Jagath Murali,, thanks for work sir,..I already mentioned that i am not using get,set.. i don't want to use it... i followed http://www.dfg-team.com/json-feeds-on-windows-phone/?lang=en to get another method and its worked fine for him But want it for my first data.. – Whats Going On Feb 03 '14 at 11:04
  • ho sir some body has down voted ur answer sir.. Please give me exact answer.. i fixed that downvote... – Whats Going On Feb 03 '14 at 11:06
  • If you don't use get and set also the value will be assigned to the property on parsing. Can you show the code how you are parsing the Json? – Jagath Murali Feb 03 '14 at 11:27
  • I am using this url... http://www.dfg-team.com/json-feeds-on-windows-phone/?lang=en.. in that i found two methods.. i want to use first one,, not get,set.. i want my JSON data as first process sir... hello Jagath Murali sir.. here every one is thinking too long sir... i want it for first method which is used in that url.. – Whats Going On Feb 03 '14 at 11:34
  • 1
    i have editted my answer to please see that. and confirm that this is what you were looking for. – Jagath Murali Feb 03 '14 at 11:54
  • Thanks sir.. i want only for.. these fields and sub fields. .JSONObject json_data = JSONfunctions.getJSONfromURL(url); JSONObject json_SData, JSONArray json_results, JSONObject json_results, JSONArray images ,JSONObject features,. JSONArray json_results_wdetails, JSONObject json_results_wdetails, JSONArray json_noffers, JSONObject json_noffers, thats all Please Update answer sir.. Thanks a lot of the answer sir.. please up date them sir.. i want only those fields.. including above.. Thanks Jagath sir.. i will make your answer useful sir.. – Whats Going On Feb 03 '14 at 12:03