title: Decoding a variable-length JSON array into a Rust array
body: <p>I'm trying to decode this data:</p>
  
  <pre><code>{
    "ok": true,
    "people": [
      {
        "name": "John",
        "age": "10"
      }
    ]
  }
  </code></pre>
  
  <p>Into a struct.The code is:</p>
  
  <pre><code>extern crate rustc_serialize;
  
  use rustc_serialize::json;
  
  #[derive(RustcDecodable)]
  struct Man {
      name: String,
      age: i32,
  }
  
  #[derive(RustcDecodable)]
  struct Men {
      ok:      bool,
      people: [Man; 16],
  }
  
  ...
  
  let json: Men = json::decode(&amp;data).unwrap();
  
  ...
  </code></pre>
  
  <p>The problem is that when the length of the array in <code>Men</code> doesn't match the length of corresponding field in JSON exactly, this error happens:</p>
  
  <pre><code>thread '&lt;main&gt;' panicked at 'called `Result::unwrap()`
  on an `Err` value: ApplicationError("wrong array length")',
  ../src/libcore/result.rs:738
  </code></pre>
  
  <p>Any ideas on how to deal with this?
  General code style advice is also welcome.</p>