title: What do JSONSerialization options do and how do they change jsonResult?
body: <p>I am using <code>JSONSerialization</code> quite often in my project.
  Here is an example of my <code>JSONSerialization</code> code:</p>
  
  <pre><code>let json = try JSONSerialization.jsonObject(with: data!, options: []) as? [String: Any] 
  </code></pre>
  
  <p><strong>Note</strong>: Options are missing for purpose and I normally have them in my project.</p>
  
  <p>My problem is that I am not pretty sure what do these <code>options: []</code> do? </p>
  
  <p><strong>What I have found about options:</strong></p>
  
  <p><strong>NSJSONReadingMutableContainers:</strong> </p>
  
  <blockquote>
    <p>Specifies that arrays and dictionaries are created as mutable objects.</p>
  </blockquote>
  
  <p><strong>NSJSONReadingMutableLeaves:</strong></p>
  
  <blockquote>
    <p>Specifies that leaf strings in the JSON object graph are created as
    instances of NSMutableString.</p>
  </blockquote>
  
  <p><strong>NSJSONReadingAllowFragments:</strong></p>
  
  <blockquote>
    <p>Specifies that the parser should allow top-level objects that are not
    an instance of NSArray or NSDictionary.</p>
  </blockquote>
  
  <p><strong>Note2</strong>: I found those definitions on : <a href="https://developer.apple.com/reference/foundation/nsjsonreadingoptions" rel="noreferrer">https://developer.apple.com/reference/foundation/nsjsonreadingoptions</a></p>
  
  <p><strong>My question is</strong>: 
  Can someone please explain me differences between those options , what should I use them for and if you could show me some code example of those options it would be perfect :).</p>
  
  <p>Any help appreciated.</p>
  
  <p>Thanks.</p>