title: Java Gson parse Json object to array
body: <p>I'm trying to parse the below Json using the Gson lib in Java. When using other languages, such as C#, this JSON is parsed into an array, however it seems Gson converts this into a set of java attributes (which to be honest, makes more sense to me). Does anyone know if I can change this behaviour of the Gson lib? </p>
  
  <pre><code>{
    "Outer": {
      "0": {
        "Attr1": 12345,
        "Attr2": 67890
      },
      "1": {
        "Attr1": 54321,
        "Attr2": 09876
      }
    }
  }
  </code></pre>
  
  <p>The below code demonstrates how Gson parses the array as a JsonObject. To be clear, I realise I've referenced <code>outer</code> as a <code>JsonObject</code> but I was just doing this to demonstrate the code. If I try and reference <code>outer</code> as an <code>JsonArray</code>, the code fails.</p>
  
  <pre><code>String json = "{\"Outer\": { \"0\": { \"Attr1\": 12345, \"Attr2\": 67890 }, \"1\": { \"Attr1\": 54321, \"Attr2\": 09876 }}}";
  Gson gson = new GsonBuilder()
              .disableHtmlEscaping()
              .setLenient()
              .serializeNulls()
              .create();
  
  JsonObject jo = gson.fromJson(json, JsonObject.class);
  JsonObject outer = jo.getAsJsonObject("Outer");
  
  System.out.println(outer);
  System.out.println(outer.isJsonArray());
  </code></pre>
  
  <p>Result:</p>
  
  <pre><code>{"0":{"Attr1":12345,"Attr2":67890},"1":{"Attr1":54321,"Attr2":"09876"}}
  false
  </code></pre>
  
  <p>//edit
  I'm using this current simple Json as an example, however my application of this code will be to parse Json that's of varying and unknown shape. I therefore need Gson to automatically parse this to an array so that the <code>isJsonArray</code> returns <code>true</code>.</p>