0

I would like to extract only one property from Json response and its in the root element. I tried several attempts but couldn't successful. Please advice.

[
  {
    "discountAmount": 0,
    "discountPercentage": 0,
    "originalPrice": null,
    "manufacturerProductCode": "9H.JA677.25E",
    "bulletPoints": [
      "Full HD (1920x1080)",
      "Kuvakoko 26\"-300\"",
      "Suuri valovoima, 4000 Lm"
    ],
    "href": "/fi/product/16592/dxrdm/BenQ-SH915-Full-HD-DLP-asennettava-projektori",
    "name": "BenQ SH915 Full HD DLP ‐asennettava projektori",
    "images": [
      {
        "host": "cdn-b.verkkokauppa.com",
        "path": "/images/14/2_195368-2500x1488.jpeg"
      },
      {
        "host": "cdn-a.verkkokauppa.com",
        "path": "/images/36/2_195368-3000x1790.jpeg"
      },
      {
        "host": "cdn-d.verkkokauppa.com",
        "path": "/images/51/2_195368-3000x1153.jpeg"
      },
      {
        "host": "cdn-b.verkkokauppa.com",
        "path": "/images/81/2_195368-3000x1425.jpeg"
      },
      {
        "host": "cdn-a.verkkokauppa.com",
        "path": "/images/96/2_195368-3000x1449.jpeg"
      },
      {
        "host": "cdn-d.verkkokauppa.com",
        "path": "/images/11/2_195368-3000x2200.jpeg"
      },
      {
        "host": "cdn-c.verkkokauppa.com",
        "path": "/images/26/2_195368-3000x1161.jpeg"
      }
    ],

This is the Json response and I would need (manufacturerProductCode) from this response.

AAP
  • 169
  • 1
  • 2
  • 17

1 Answers1

2

Dynamic object can solve this problem easily. Or you can try Linq to Json.

dynamic obj = JObject.Parse(json);
Console.WriteLine((string)obj.manufacturerProductCode);
Community
  • 1
  • 1
Pradeep
  • 3,258
  • 1
  • 23
  • 36