title: How to convert specific JSONArray to JAVA object?
body: <p>In Java project I used WebSocket to get subscription and I get many different responses from socket as <code>JSONArray</code>, the one which I need looks as below:</p>
  
  <pre><code>[
    68,
    "te",
    [
      80588348,
      1508768162000,
      0.01569882,
      5700.8
    ]
  ]
  </code></pre>
  
  <p>How should look <code>JAVA</code> object for this response?
  How can I convert it to this object?</p>
  
  <pre><code>[
    68, &lt;- Integer
    "te", &lt;- String
    [
      80588348, &lt;- Long
      1508768162000, &lt;- Long
      0.01569882, &lt;- Double
      5700.8 &lt;- Double
    ]
  ]
  </code></pre>
  
  <p>There is one problem that there are other responses like:</p>
  
  <pre><code>{"event":"subscribed","channel":"trades","chanId":68,"symbol":"tBTCUSD","pair":"BTCUSD"}
  </code></pre>
  
  <p>And when I try convert it by <code>new JSONArray(response)</code> it throws <code>org.json.JSONException: A JSONArray text must start with '[' at 1 [character 2 line 1].</code> </p>
  
  <p>How to get and convert this fields which I need(the first response example) ? </p>
  
  <p>I want get something like this:</p>
  
  <pre><code>public class Details{
     public Long id;
     public Long timestamp;
     public Double amount;
     public Double price;
  }
  
  public class Response{
     public Integer id;
     public String type;
     public Details details;
  }
  </code></pre>