title: Groovy replacing a string in JSON Block
body: <p>I have spent hours on this and getting frustrated now. I have built this string (note this string is variable but looks like below and must have the same syntax for "Id1" or "Id2" except the values can be different)</p>
  
  <pre><code>str1= [{"Id1": 775},{"Id2": 776}]
  </code></pre>
  
  <p>I like to replace  the entire value for myList: [{"Id": 0}], as shown below in my JSON block with that str1</p>
  
  <pre><code>someJson: {
      "myList": [{"Id": 0}],
  }
  </code></pre>
  
  <p>SO I have </p>
  
  <pre><code>abc = new groovy.json.JsonSlurper().parse(someJson);
  abc.myList= str1
  </code></pre>
  
  <p>My resulting output on that JSON block is this, I dont want the \  I have tried escaping but it doesnt work</p>
  
  <pre><code>"myList": "[{\"Id1\": 775},{\"Id2\": 776}]",
  </code></pre>
  
  <p>It looks like Groovy adds those \ right behind my "  I dont want groovy to do that. I want it to take my str1 and just replace it in mylist.  I even tried adding \ or \\ behind the " in str1  but it didnt work.</p>
  
  <p>I think I have to convert str1 to a map in groovy?? so I tried  </p>
  
  <pre><code>    abc.myList= Eval.me(str1)
  </code></pre>
  
  <p>but I am getting this error</p>
  
  <pre><code>Script1.groovy: 1: expecting '}', found ':' @ line 1, column 15.
     [{"Id1": 775},{"Id2": 776}]
  </code></pre>