title: Convert JSON to C# inline class with values set
body: <p>I need to generate test cases (using <code>IEnumerable&lt;TestCaseData&gt;</code>) from JSON objects that have values set. I couldn't find any tools online that would generate C# classes that have values set (<a href="http://json2csharp.com/" rel="noreferrer">Plenty that generate classes</a>).  Deserializing Json in test cases would invalidate test (One should only be testing the code), <a href="https://regex101.com/r/cQ5bH9/2" rel="noreferrer">so I did this regex</a>.</p>
  
  <p>It's not perfect but worked just fine with most basic well formatted JSON when all properties are of same type (decimals or bools),
  pattern: <code>"([a-zA-Z]?[a-zA-Z0-9].*)" ?: ?((true|false|null)|([\d].*))</code> , replace <code>$1 = $2M</code> however when there are many types and they are mixed I get screwed. </p>
  
  <p>I am sure someone ran into this before me and I am reinventing wheel so in a nutshell.</p>
  
  <p>How do I make this:</p>
  
  <pre><code>{
      "LegalFeeNet": 363.54,
      "LegalFeeVat": 72.708,
      "DiscountNet": 0.0,
      "DiscountVat": 0.0,
      "OtherNet": 12.0,
      "OtherVat": 2.4,
      "DisbursementNet": 220.0,
      "DisbursementVat": 0.0,
      "AmlCheck": null,
      "LegalSubTotal": 363.54,
      "TotalFee": 450.648,
      "Discounts": 0.0,
      "Vat": 75.108,
      "DiscountedPrice": 360.5184,
      "RecommendedRetailPrice": 450.648,
      "SubTotal": 375.54,
      "Name": "Will",
      "IsDiscounted": false,
      "CustomerCount": 3
  }
  </code></pre>
  
  <p>to become this:</p>
  
  <pre><code>ClassName {
      LegalFeeNet = 363.54M,
      LegalFeeVat = 72.708M,
      DiscountNet = 0.0M,
      DiscountVat = 0.0M,
      OtherNet = 12.0M,
      OtherVat = 2.4M,
      DisbursementNet = 220.0M,
      DisbursementVat = 0.0M,
      AmlCheck = nullM,
      LegalSubTotal = 363.54M,
      TotalFee = 450.648M,
      Discounts = 0.0M,
      Vat = 75.108M,
      DiscountedPrice = 360.5184M,
      RecommendedRetailPrice = 450.648M,
      SubTotal = 375.54M,
      Name = "Will",
      IsDiscounted = false,
      CustomerCount = 3
  }
  </code></pre>
  
  <p><strong>What fastest/most convenient solution is to generate C# classes that have properties set from JSON objects?</strong></p>