title: Powershell: How to Update/Replace data and values in Json and XML Object
body: <p>So I am having a bit of a problem here, I can't seem to figure out how to update data values in an Object </p>
  
  <p>so lets say for example the FOLLOWING json </p>
  
  <pre><code>{
      "People": 263,
      "Hungry": true,
      "Fruits": {
          "Apples": 1 "Oranges": 2
      },
      "Places": {
          "Places": [{
                  "Baskets": "true",
                  "name": "Room 1",
                  "candycount": 1500,
                  "candytypespresent": {
                      "candies": [
                          "caramel"
                      ]
                  }
  
              },
              {
  
                  "Baskets": "false",
                  "name": "Room 2",
                  "candycount": 2000,
                  "candytypespresent": {
                      "candies": [
                          "caramel",
                          "jawbreaker",
                          "butterscotch"
                      ]
                  }
              }
          ]
      }
  }
  </code></pre>
  
  <p>I have Powershell read it smoothly with <code>convertfrom-json</code></p>
  
  <p><strong>How would I do the following:</strong></p>
  
  <p>A) Change "Oranges" from "2" to "100"</p>
  
  <p>B) "Baskets" in Room 2 from "false" to "true"</p>
  
  <p>C) add "bubblegum" to "candies" in Room1</p>
  
  <p><strong>HOW can I update this without rewriting the WHOLE json or object</strong>?</p>