title: CPP: Getting json.exception.type_error.302 when trying to parse a vector of data to a json object
body: <p>I have a <code>vector&lt;unsigned char&gt;</code> which I'm trying to parse into a json object using nholman json library.</p>
  <p>My vector looks like that:</p>
  <pre><code>{\&quot;username\&quot;: \&quot;user1\&quot;, \&quot;password\&quot;: \&quot;1234\&quot;, \&quot;mail\&quot;: \&quot;user1@gmail.com\&quot;}
  </code></pre>
  <p>and when trying to use the parse method like so:</p>
  <pre><code>json = nlohmann::json::parse(data);
  </code></pre>
  <p>I get this error:</p>
  <p><code>&quot;[json.exception.type_error.302] type must be string, but is null&quot;</code></p>
  <p>Now I've also tried to parse the data using a string that I've acquired after pushing the data that is in the vector into a string like so:</p>
  <pre><code>std::string bufferAsString(buffer.begin(), buffer.end());
  </code></pre>
  <p>But this results in the same error as well. I've read the documentation of the library ( Here: <a href="https://github.com/nlohmann/json" rel="nofollow noreferrer">https://github.com/nlohmann/json</a> ) and looked at the parse section and I can't seem to find anything that is different between my example and his, so why do I still get this problem?</p>
  <p>EDIT: I've fixed the problem, it seems that I've passed the data with the key &quot;mail&quot; but used the key &quot;email&quot; to search for the mail when I used the <code>get</code> method, remember to check if you use the correct keys because that results in this error which isn't really explaining that much.</p>