title: Laravel: I cannot access to object property in nested json
body: <p>I'm working with angular and laravel,I have this json in my request, but for some reason I cannot access to the data inside the key called "llave_criptografica" , this is the complete json</p>
  
  <pre><code>{username: "eeded", contrasena: null, llave_criptografica: {…}, clave_criptografica: null}
  </code></pre>
  
  <p>the data inside "llave_criptografica" is this</p>
  
  <pre><code>{filename: "011503046233.p12", filetype: "application/x-pkcs12", value: "MIIaPAIBAzCCGfYG-base-64-encode"}
  </code></pre>
  
  <p>as you can see, I just have encoded and send a key with base64, but when I try to access to it, I get this error</p>
  
  <pre><code>        return $request-&gt;llave_criptografica-&gt;filename;
  </code></pre>
  
  <blockquote>
    <p>Trying to get property of non-object</p>
  </blockquote>
  
  <p>if I try to access as an array this is the error</p>
  
  <pre><code>        return $request-&gt;llave_criptografica["filename"];
  </code></pre>
  
  <blockquote>
    <p>Unexpected number in JSON at position 1 at JSON.parse</p>
  </blockquote>
  
  <p>this is the function where I store the file data</p>
  
  <pre><code>onFileChange(event) {
  let reader = new FileReader();
  if(event.target.files &amp;&amp; event.target.files.length &gt; 0) {
    let file = event.target.files[0];
    reader.readAsDataURL(file);
    reader.onload = () =&gt; {
      this.formCertificado.get('llave_criptografica').setValue({
        filename: file.name,
        filetype: file.type,
        value: reader.result.split(',')[1]
      })
  
          }
    }
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/fkXrO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fkXrO.png" alt="enter image description here"></a></p>
  
  <p>When I do a log, this is the content of the key</p>
  
  <pre><code>array ( 'username' =&gt; 'eded', 'contrasena' =&gt; NULL, 'llave_criptografica' =&gt; array ( 'filename' =&gt; '011503046233.p12', 'filetype' =&gt; 'application/x-pkcs12', 'value' =&gt; 'MIIaP-base-64', ), 'clave_criptografica' =&gt; NULL, )
  </code></pre>