title: TransformField in JArray with json4s
body: <p>I'm giving Scala a try, and in particular the <a href="http://json4s.org/" rel="nofollow">json4s</a> lib in order to manipulate some json. I'm having a hard time with the syntax of both Scala and <a href="http://json4s.org/" rel="nofollow">json4s</a>, thought I'd ask you guys.</p>
  
  <p>I have this json, which I need to update some fields on, and send back intact in it's entirety to a service. The json looks like this:</p>
  
  <pre><code>{
      "id": "6804",
      "signatories": [
          {
              "id": "12125",
              "fields": [
                  {
                      "type": "standard",
                      "name": "fstname",
                      "value": "John"
                  },
                  {
                      "type": "standard",
                      "name": "sndname",
                      "value": "Doe"
                  },
                  {
                      "type": "standard",
                      "name": "email",
                      "value": "john.doe@somwhere.com"
                  },
                  {
                      "type": "standard",
                      "name": "sigco",
                      "value": "Company"
                  }
              ]
          }
      ]
  }
  </code></pre>
  
  <p>I am using <a href="http://json4s.org/" rel="nofollow">json4s</a> to parse this into a JArray, like this:</p>
  
  
  
  <pre><code>import org.json4s._
  import org.json4s.native.JsonMethods._
  
  val data = parse(json)
  val fields = (data \ "signatories" \ "fields")
  </code></pre>
  
  <p>This gives me a JArray containing all fields: (So very sorry for formatting)</p>
  
  
  
  <pre><code>JArray(List(JObject(List((type,JString(standard)), (name,JString(fstname)), (value,JString(John)))), JObject(List((type,JString(standard)), (name,JString(sndname)), (value,JString(Doe)))), JObject(List((type,JString(standard)), (name,JString(email)), (value,JString(john.doe@somwhere.com)))), JObject(List((type,JString(standard)), (name,JString(sigco)), (value,JString(Company))))))
  </code></pre>
  
  <p>The problem I'm faced with now, is:</p>
  
  <p><strong>how do I find every fields property "name", and change it (transform), into a new value?</strong></p>
  
  <p>For example (I know this isn't how it works in Scala most likely, but you'll get the idea)</p>
  
  
  
  <pre><code>foreach(field in fields) {
       if(field.name == 'fstname') {
            field.value = "Bruce"
       }
  }
  </code></pre>