title: Deserialise JSON from a solar inverter API
body: <p>I have JSON data from a Fronius solar inverter. I'm trying to read it into VB.NET classes so I can then work some other magic on it (add to a DB, use the info to control household devices etc).
  I've parsed the JSON through some online resource that all say it's ok.<br />
  When running my code the classes are coming back as nothing.<br />
  Here's the base code for deserializing:</p>
  <pre><code>Dim fileReader As System.IO.StreamReader = My.Computer.FileSystem.OpenTextFileReader(&quot;C:\Temp\JsonCrap.js&quot;)
  Dim jsonData As String = fileReader.ReadToEnd
  fileReader.Close()
  Dim myJs = JsonConvert.DeserializeObject(Of Body)(jsonData)
  </code></pre>
  <p>When I expand <code>myJS</code>, it shows the data properties from my class but with no values.<br />
  JSON is this:</p>
  <pre><code>{
     &quot;Body&quot; : {
        &quot;Data&quot; : {
           &quot;DAY_PMAX&quot; : {
              &quot;Unit&quot; : &quot;W&quot;,
              &quot;Value&quot; : 2013
           },
           &quot;DAY_UACMAX&quot; : {
              &quot;Unit&quot; : &quot;V&quot;,
              &quot;Value&quot; : 244.80000000000001
           },
           &quot;DAY_UDCMAX&quot; : {
              &quot;Unit&quot; : &quot;V&quot;,
              &quot;Value&quot; : 375.19999999999999
           },
           &quot;TOTAL_PMAX&quot; : {
              &quot;Unit&quot; : &quot;W&quot;,
              &quot;Value&quot; : 5568
           },
           &quot;TOTAL_UACMAX&quot; : {
              &quot;Unit&quot; : &quot;V&quot;,
              &quot;Value&quot; : 285.5
           },
           &quot;TOTAL_UDCMAX&quot; : {
              &quot;Unit&quot; : &quot;V&quot;,
              &quot;Value&quot; : 389.19999999999999
           },
           &quot;YEAR_PMAX&quot; : {
              &quot;Unit&quot; : &quot;W&quot;,
              &quot;Value&quot; : 5562
           },
           &quot;YEAR_UACMAX&quot; : {
              &quot;Unit&quot; : &quot;V&quot;,
              &quot;Value&quot; : 277.30000000000001
           },
           &quot;YEAR_UDCMAX&quot; : {
              &quot;Unit&quot; : &quot;V&quot;,
              &quot;Value&quot; : 375.19999999999999
           }
        }
     },
     &quot;Head&quot; : {
        &quot;RequestArguments&quot; : {
           &quot;DataCollection&quot; : &quot;MinMaxInverterData&quot;,
           &quot;DeviceClass&quot; : &quot;Inverter&quot;,
           &quot;DeviceId&quot; : &quot;1&quot;,
           &quot;Scope&quot; : &quot;Device&quot;
        },
        &quot;Status&quot; : {
           &quot;Code&quot; : 0,
           &quot;Reason&quot; : &quot;&quot;,
           &quot;UserMessage&quot; : &quot;&quot;
        },
        &quot;Timestamp&quot; : &quot;2021-07-22T11:34:44+10:00&quot;
     }
  }
  </code></pre>
  <p>And classes are here:</p>
  <pre><code>Imports Newtonsoft.Json
  Imports Newtonsoft.Json.Serialization
  
  Public Class Body
      &lt;JsonProperty(PropertyName:=&quot;Body&quot;)&gt;
      Public Property Data As Data
  End Class
  
  Public Class Data
      &lt;JsonProperty(PropertyName:=&quot;DAY_PMAX&quot;)&gt;
      Public Property DAY_PMAX As DAYPMAX
  
      &lt;JsonProperty(PropertyName:=&quot;DAY_UACMAX&quot;)&gt;
      Public Property DAY_UACMAX As DAYUACMAX
  
      &lt;JsonProperty(PropertyName:=&quot;DAY_UDCMAX&quot;)&gt;
      Public Property DAY_UDCMAX As DAYUDCMAX
  
      &lt;JsonProperty(PropertyName:=&quot;TOTAL_PMAX&quot;)&gt;
      Public Property TOTAL_PMAX As TOTALPMAX
  
      &lt;JsonProperty(PropertyName:=&quot;TOTAL_UACMAX&quot;)&gt;
      Public Property TOTAL_UACMAX As TOTALUACMAX
  
      &lt;JsonProperty(PropertyName:=&quot;TOTAL_UDCMAX&quot;)&gt;
      Public Property TOTAL_UDCMAX As TOTALUDCMAX
  
      &lt;JsonProperty(PropertyName:=&quot;YEAR_PMAX&quot;)&gt;
      Public Property YEAR_PMAX As YEARPMAX
  
      &lt;JsonProperty(PropertyName:=&quot;YEAR_UACMAX&quot;)&gt;
      Public Property YEAR_UACMAX As YEARUACMAX
  
      &lt;JsonProperty(PropertyName:=&quot;YEAR_UDCMAX&quot;)&gt;
      Public Property YEAR_UDCMAX As YEARUDCMAX
  End Class
  
  Public Class DAYPMAX
      Public Property Unit As String
      Public Property Value As Integer
  End Class
  
  Public Class DAYUACMAX
      Public Property Unit As String
      Public Property Value As Double
  End Class
  
  Public Class DAYUDCMAX
      Public Property Unit As String
      Public Property Value As Double
  End Class
  
  Public Class TOTALPMAX
      Public Property Unit As String
      Public Property Value As Integer
  End Class
  
  Public Class TOTALUACMAX
      Public Property Unit As String
      Public Property Value As Double
  End Class
  
  Public Class TOTALUDCMAX
      Public Property Unit As String
      Public Property Value As Double
  End Class
  
  Public Class YEARPMAX
      Public Property Unit As String
      Public Property Value As Integer
  End Class
  
  Public Class YEARUACMAX
      Public Property Unit As String
      Public Property Value As Double
  End Class
  
  
  
  Public Class YEARUDCMAX
      Public Property Unit As String
      Public Property Value As Double
  End Class
  
  Public Class RequestArguments
      Public Property DataCollection As String
      Public Property DeviceClass As String
      Public Property DeviceId As String
      Public Property Scope As String
  End Class
  
  Public Class Status
      Public Property Code As Integer
      Public Property Reason As String
      Public Property UserMessage As String
  End Class
  
  Public Class Head
      Public Property RequestArguments As RequestArguments
      Public Property Status As Status
      Public Property Timestamp As DateTime
  End Class
  
  Public Class Example
      Public Property Body As Body
      Public Property Head As Head
  End Class
  </code></pre>