title: Java json-simple accessing via object properties
body: <p>One of my gripes with JSON-Simple is that if you have a heavily nested structure, then it becomes very verbose to access information. </p>
  
  <p>Consider a trivial JSON object:</p>
  
  <pre><code>{
    "announcements": {
      "inGame": {
        "playerDied": "{arg1} has died"
      }
    }
  }
  </code></pre>
  
  <p>Should I want to print out "{arg1} has died", as I currently understand it, I must do the following:</p>
  
  <pre><code> InputStreamReader inputStreamReader =
           new InputStreamReader(getClass().getResourceAsStream(configurationPath));
  
   JSONObject jsonObject = (JSONObject) parser.parse(inputStreamReader);
  
   String died = (String)((JSONObject)((JSONObject)jsonObject.get("announcements")).get("inGame")).get("playerDied");
  
   System.out.println(died);
  </code></pre>
  
  <p>As you can see, lots of casting, and lots of chaining.</p>
  
  <p>My question is: <em>Is there an easier way to go about this?</em></p>
  
  <p>For example:</p>
  
  <pre><code>String died = jsonObject.get("announcements").get("inGame").get("playerDied");
  </code></pre>
  
  <p>Or, even better:</p>
  
  <pre><code>String died = jsonObject.get("announcements.inGame.playerDied");
  </code></pre>
  
  <p>I feel like I'm missing something.</p>