title: How to replace property value in dynamic JSON
body: <p>How to replace property value in JSON string?</p>
  
  <p>I have json data as follows:</p>
  
  <pre><code>{
    "httpCode" : 200,
    "message" : "OK",
    "result" : {
      "furnitureItem" : {
        "id" : "f_1150426",
        "vertical" : "furniture",
        "title" : "Antique Tribal Gashgai Persian Rug",
        "description" : "Named after the Qashqa'i tribe in Persia, these nomadic rugs represent the skillful weaving styles of the tribe. Combining unique details with traditional family motifs the rugs are heavily ornamented. They often feature geometric patterns and highly developed floral designs. The colors often feature red, saffron yellow and navy. A distinguishable mark of Qashqai antique rugs is the use of flat weave.",
        "dealerReference" : "47550",
        "dibsReference" : "LU85971150426",
        "dateAdded" : "2014-05-12T15:23:26.000-04:00",
        "dateSold" : "1969-12-31T19:00:00.000-05:00",
        "releaseDate" : "2014-05-14T11:00:00.000-04:00",
        "modifiedDate" : "2014-05-12T23:48:19.000-04:00",
        "uploadType" : "USER",
        "status" : {
          "productStatus" : "UNRELEASED",
          "contactForPrice" : "N",
          "locked" : "Y",
          "posted" : "Y",
          "newListing" : "N",
          "inSaturdaySale" : "Y",
          "saveReleaseLater" : "N"
        },
        "overrideShipping" : "N",
        "pieces" : 1,
        "material" : {
          "description" : "Wool / hand Made",
          "restricted" : "N"
        },
        "customMaterial" : {
          "restricted" : "N",
          "description" : "Wool / hand Made"
        },
        "publishOptions" : {
          "dibs" : "Y",
          "featured" : "Y",
          "nydc" : "N",
          "storefront" : "Y",
          "workInProgress" : "N",
          "listedFrenchItem" : "N",
          "addText" : "N",
          "queuedForPosting" : "N",
          "rejected" : "N",
          "approved" : "N",
          "onHold" : "N",
          "deleted" : "N",
          "sold" : "N",
          "photoRepair" : "N",
          "previouslySold" : "N",
          "unpublished" : "N"
        },
        "seller" : {
          "id" : "f_8597",
          "status" : "active"
        },
        "store" : {
          "id" : 617
        },
        "classification" : {
          "style" : { },
          "countryOfOrigin" : "Iran",
          "categories" : [ "J32" ],
          "creationDate" : "Circa 1900",
          "period" : "_1900_TO_1920"
        },
        "measurement" : {
          "unit" : "IN",
          "width" : "60",
          "length" : "87",
          "weight" : { },
          "volume" : "0.0",
          "shape" : "rectangular2d"
        },
        "condition" : {
          "state" : "EXCELLENT",
          "damageLosses" : "N",
          "damageLight" : "N",
          "damageSound" : "N",
          "damageFading" : "N"
        },
        "images" : [ {
          "position" : 1,
          "status" : "PENDING",
          "thumb" : "/archivesE/upload/8597/20_14/antiquetribalgashgaipersianrug/antiquetribalGashgaipersianrug47550nazmiyal_t.jpeg",
          "small" : "/archivesE/upload/8597/20_14/antiquetribalgashgaipersianrug/antiquetribalGashgaipersianrug47550nazmiyal_l_s.jpeg",
          "medium" : "/archivesE/upload/8597/20_14/antiquetribalgashgaipersianrug/antiquetribalGashgaipersianrug47550nazmiyal_l_m.jpeg",
          "large" : "/archivesE/upload/8597/20_14/antiquetribalgashgaipersianrug/antiquetribalGashgaipersianrug47550nazmiyal_l.jpeg"
        }, {
          "position" : 2,
          "large" : ""
        }, {
          "position" : 3,
          "large" : ""
        }, {
          "position" : 4,
          "large" : ""
        }, {
          "position" : 5,
          "large" : ""
        }, {
          "position" : 6,
          "large" : ""
        }, {
          "position" : 7,
          "large" : ""
        }, {
          "position" : 8,
          "large" : ""
        }, {
          "position" : 9,
          "large" : ""
        }, {
          "position" : 10,
          "large" : ""
        } ],
        "shipping" : [ {
          "id" : 228066,
          "quoteSource" : {
            "role" : "SELLER",
            "id" : "f_8597"
          },
          "shipmentQuoteType" : "PRE_QUOTE",
          "currency" : "USD",
          "subTotal" : 0.00,
          "totalAmount" : 0.00,
          "shipmentCostIncluded" : "Y",
          "complimentaryShipping" : "Y",
          "handlingTimeDays" : 2,
          "serviceMethod" : {
            "windowMin" : 3,
            "windowMax" : 21,
            "windowUnit" : "DAY",
            "region" : "REST_OF_WORLD",
            "methodName" : "STANDARD"
          },
          "anchor" : {
            "sourceId" : "f_1150426",
            "sourceType" : "ITEM"
          },
          "amountCurrencies" : {
            "EUR" : 0.00,
            "PND" : 0.00,
            "USD" : 0.00
          },
          "invoiceItemType" : "SHIPMENT",
          "adjustmentDocumentType" : "SHIPMENT_QUOTE"
        } ],
        "pricing" : {
          "currency" : "USD",
          "lowestPrice" : 0.0,
          "amount" : 9500.0,
          "pricePerPiece" : "N",
          "negotiable" : "Y",
          "hidePrice" : "N",
          "bargain" : "N",
          "qualifyForBargain" : "Y",
          "initialPrice" : 9500,
          "initialPriceCurrencies" : {
            "EUR" : 6745.00,
            "PND" : 5510.00,
            "USD" : 9500.00
          },
          "amountCurrencies" : {
            "EUR" : 6745.00,
            "PND" : 5510.00,
            "USD" : 9500.00
          }
        },
        "returnPolicy" : { }
      }
    }
  }
  </code></pre>
  
  <p>I want to replace the value of "images" property with following:</p>
  
  <pre><code>      "images": [
          {
            "position": 1,
            "thumb": "/archivesE/upload/8597/20_14/1150426/1150426_t.jpeg",
            "small": "/archivesE/upload/8597/20_14/1150426/1150426_l_s.jpeg",
            "medium": "/archivesE/upload/8597/20_14/1150426/1150426_l_m.jpeg",
            "large": "/archivesE/upload/8597/20_14/1150426/1150426_l.jpeg"
          },
          {
            "position": 2,
            "thumb": null,
            "small": null,
            "medium": null,
            "large": ""
          },
          {
            "position": 3,
            "thumb": null,
            "small": null,
            "medium": null,
            "large": ""
          },
          {
            "position": 4,
            "thumb": null,
            "small": null,
            "medium": null,
            "large": ""
          },
          {
            "position": 5,
            "thumb": null,
            "small": null,
            "medium": null,
            "large": ""
          },
          {
            "position": 6,
            "thumb": null,
            "small": null,
            "medium": null,
            "large": ""
          },
          {
            "position": 7,
            "thumb": null,
            "small": null,
            "medium": null,
            "large": ""
          },
          {
            "position": 8,
            "thumb": null,
            "small": null,
            "medium": null,
            "large": ""
          },
          {
            "position": 9,
            "thumb": null,
            "small": null,
            "medium": null,
            "large": ""
          },
          {
            "position": 10,
            "thumb": null,
            "small": null,
            "medium": null,
            "large": ""
          }
        ],
  </code></pre>
  
  <p>I tried RegEx:</p>
  
  <pre><code>"images"\s*:\s*\[\s*{[\s\S]+}
  </code></pre>
  
  <p><strong>UPDATE</strong>
  Here's what I have tried with JSON.NET:
  I am not able to set the property value of the "images" array</p>
  
  <pre><code>void Main()
  {
      var newValue = new[] { new Test(){Position="1"}, new Test(){Position="2"}};
      string json = File.ReadAllText("E:\\JSON.txt");
      dynamic rss = JObject.Parse(json);
      rss["result"]["furnitureItem"]["images"] = newValue;//this line throws error
      Console.WriteLine(rss.ToString());
  }
  
  public class Test
  {
      public string Position {get;set;}
  }
  </code></pre>