title: Parsing an object inside an object with serde_json
body: <p>I am stuck, below is the JSON which I am receiving:</p>
  
  <pre><code>{
     "BCH": {
        "aclass": "currency",
        "altname": "BCH",
        "decimals": 10,
        "display_decimals": 5
     }
  }
  </code></pre>
  
  <p>I am bit confused on how my struct should look like to parse the attributes using the<code>serde_json</code> crate. Below is what I currently have:</p>
  
  <pre><code>#[derive(Deserialize, Debug)]
  struct Assets  {  
      aclass: String,
      altname: String,
      decimals: u8,
      display_decimals: u8,
  }
  
  #[derive(Deserialize, Debug)]
  struct Currency {
      assest: Assets,
  }
  
  
  fn to_assets_type(value: serde_json::Value) -&gt; Currency {
   serde_json::from_value(value).unwrap()
  }
  </code></pre>
  
  <p>I am getting an error message:</p>
  
  <blockquote>
    <p>thread 'main' panicked at 'called <code>Result::unwrap()</code> on an <code>Err</code>
    value: ErrorImpl { code: Message("missing field <code>assest</code>"), line: 0,
    column: 0 }', src/libcore/result.rs:860:4</p>
  </blockquote>