title: How can I cast a JSONObject to a custom Java class?
body: <p>In Java (<a href="https://code.google.com/p/json-simple/" rel="noreferrer">using json-simple</a>) I have successfully parsed a JSON string which was created in JavaScript using JSON.stringify.  It looks like this:</p>
  
  <pre><code>{"teq":14567,"ver":1,"rev":1234,"cop":15678}
  </code></pre>
  
  <p>This string is storing the state of a custom JavaScript object which I now wish to re-constitute as a pure Java class.  Its not going well - first foray into Java coming from a C# background.    :-p</p>
  
  <p>The object is currently in the form of a org.json.simple.JSONObject since that is what json-simple made from the JSONParser.parse() operation.</p>
  
  <p><strong>How can I cast this JSONObject to my new Java class?</strong> (the definition of which is below...)</p>
  
  <pre><code>public class MyCustomJSObject {
      public int teq;
      public int ver;
      public int rev;
      public int cop;
  }
  </code></pre>