title: rereplace on json string with ColdFusion
body: <p>This does not work. The json is valid.  I would like eventually to replace any <code>Distributor_ID</code>: 100 with <code>Distributor_ID</code>: 55.  There may be any number of nested items in the json and the path to <code>Distributor_ID</code> could vary. If it were deserialized to a structure first, I would have to search for it by path and replace everywhere it was found.  I thought since json is a string, then a simple replace could do it quickly, but I get an error:</p>
  
  <pre><code>Invalid token " found.
  </code></pre>
  
  <p>How else to quickly replace a value in serialized json with CF?  Does a quote or apostrophe need to be escaped?</p>
  
  <pre><code>&lt;cfset jsonstring= '"SUPPLY": [
  {
      "SRole_ID": 1,
      "Distributor_ID": 100,
      "Test": "E974564E-B252-148D-E6FD5EF429885236"
  },
  {
      "SRole_ID": 1,
      "Distributor_ID": 100,
      "Test": "EC08B56C-95BE-0DCA-DD7789978A05D788"
  },
  {
      "SRole_ID": 1,
      "Distributor_ID": 13,
      "Test": "EC0BA1FB-F6A7-29E3-CC92FD509BCD487C"
  },
  {
      "SRole_ID": 1,
      "Distributor_ID": 15,
      "Test": "EC0FEC88-018E-CCEA-668038434E83A4E7"
  }
  ]'&gt;
  &lt;cfset newjson =  ReplaceNoCase(jsonstring, 'Distributor_ID": 100', 'Distributor_ID": 50', "ALL")&gt;
  &lt;cfdump var="#newjson#"&gt;
  </code></pre>