How to parse a 3d JSON array in java
<p>Here is my json data:</p>

<pre><code>"LM":  [
    [
        ["Fund1", "4"],
        ["Fund3", "41"],
        ["Fund4", "41"],
        ["Fund5", "42"]
    ],
    [
        ["Navs1", "12"],
        ["Navs2", "13"]
    ],
    [
        ["Navs1", "14"],
        ["Navs2, "15"],
        ["Navs3", "16"]
    ]
 ]
</code></pre>

<p>Here is my android code:</p>

<pre><code>    JSONArray LM3DArray = reader.getJSONArray("LM");
    LM = new String[LM3DArray.length()][LM3DArray.length()][LM3DArray.length()];
    for(int i_lm=0;i_lm&lt;LM3DArray.length();i_lm++) {
         for(int j_lm = 0; j_lm &lt; LM3DArray.getJSONArray(i_lm).length(); j_lm ++) {
              for(int k_lm = 0; k_lm &lt; LM3DArray.getJSONArray(j_lm).length(); k_lm ++) {
                 LM[i_lm][j_lm][k_lm] = (String) LM3DArray.getJSONArray(i_lm).getJSONArray(j_lm).get(k_lm);
                  Log.d("Print ", "  LM " + LM[i_lm][j_lm][k_lm]);
              }
         }
    } 
</code></pre>

<p>I get the following error in my logcat:</p>

<pre><code>    03-13 23:18:27.186 1651-1651/user.com.testapp D/Print:   LM Fund1
    03-13 23:18:27.218 1651-1651/user.com.testapp D/Print:   LM 4
    03-13 23:18:27.219 1651-1651/user.com.testapp W/System.err:   org.json.JSONException: Index 2 out of range [0..2)
</code></pre>

<p>It would be helpful if someone could pinpoint me to the right direction. Thanks in advance. </p>