title: Java: Json has key/field
body: <p>I'd like to know the most simple way to detect if a key/field exists in a JSON String.</p>
  
  <p>for example:</p>
  
  <pre><code>if(jsonObject(myJsonString).hasKey("myKey")){
  
  }
  </code></pre>
  
  <p>I would not prefer to write a lot. I am currently using minimal JSON and it appears it does not have such a function.</p>
  
  <p><strong>Answer:
  JSONObject jsonObj2 = new JSONObject(message);
  if(jsonObj2.has("key"));</strong></p>