title: Cannot assign to immutable expression of type ' AnyObject?!'
body: <p>I did some search but still cannot figure out how to solve the error.
  Basically I am reading booklist from Json file and then update it. The reading part is fine but error ("Cannot assign to immutable expression of type ' AnyObject?!'") happens when trying to update.</p>
  
  <pre><code>var url = NSBundle.mainBundle().URLForResource("Book", withExtension: "json")
  
  var data = NSData(contentsOfURL: url!)
  
  var booklist = try! NSJSONSerialization.JSONObjectWithData(data!, options: []) as! NSMutableArray
  
  
  for boo in booklist {
              if (boo["name"]  as! String) == "BookB" {
                  print (boo["isRead"]) //see Console Output
                  boo["isRead"] = "true"  //this gets error "Cannot assign to immutable expression of type ' AnyObject?!'"
              }
  </code></pre>
  
  <p>The Json file Book.json is as below:</p>
  
  <pre><code>[
  {"name":"BookA","auth":"AAA","isRead":"false",},
  {"name":"BookB","auth":"BBB","isRead":"false",},
  {"name":"BookC","auth":"CCC","isRead":"false",},
  ]
  </code></pre>
  
  <p>The booklist has expected values, see Console output:</p>
  
  <pre><code>(
          {
          name = BookA;
          auth = AAA;
          isRead = false;
      },
          {
          name = BookB;
          auth = BBB;
          isRead = false; 
      },
         {
          name = BookC;
          auth = CCC;
          isRead = false;
      }
  )
  </code></pre>
  
  <p>and for <code>print (boo["isRead"])</code>, the console result is <code>Optional(false)</code>, which is correct.</p>
  
  <p>Booklist is already a NSMutableArray, and I also tried to change as </p>
  
  <pre><code>var booklist = try! NSJSONSerialization.JSONObjectWithData(data!, options: NSJSONReadingOptions.MutableContainers) as! NSMutableArray
  </code></pre>
  
  <p>but it does not help.</p>
  
  <p>Also referred to <a href="https://stackoverflow.com/questions/32093692/swift-cannot-assign-to-immutable-expression-of-type-anyobject">Swift: Cannot assign to immutable expression of type &#39;AnyObject?!&#39;</a>, changing to below also get the same error:</p>
  
  <pre><code>var mutableObjects = booklist
  for var boo in mutableObjects {
              if (boo["name"]  as! String) == "BookB" {
                  print (boo["isRead"]) //see Console Output
                  boo["isRead"] = "true"  //this gets error "Cannot assign to immutable expression of type ' AnyObject?!'"
              }
  </code></pre>
  
  <p>Could anyone advise how to update the isRead in booklist for BookB in this case. Or even better how to update the Book.json file.</p>