{"id":1934,"date":"2012-12-18T14:54:00","date_gmt":"2012-12-18T14:54:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/webdev\/2012\/12\/18\/paste-json-as-classes-in-asp-net-and-web-tools-2012-2-rc\/"},"modified":"2022-08-10T01:23:57","modified_gmt":"2022-08-10T08:23:57","slug":"paste-json-as-classes-in-asp-net-and-web-tools-2012-2-rc","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/dotnet\/paste-json-as-classes-in-asp-net-and-web-tools-2012-2-rc\/","title":{"rendered":"\u2018Paste JSON As Classes\u2019 in ASP.NET and Web Tools 2012.2 RC"},"content":{"rendered":"<p>\u2018Paste JSON As Classes\u2019 is a cool feature in ASP.NET and Web Tools 2012.2 RC. This feature will help you generate strongly typed classes in C# or VB.NET from valid JSON text.<\/p>\n<p>With ASP.NET and Web Tools 2012.2 RC installed, you will see new menu option like below for C# and VB.NET Website and Web Application projects only. This new menu option will be enabled for .cs and .vb file extensions inside these projects:<\/p>\n<p align=\"left\"><a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2012\/12\/2021.clip_image001_thumb_701EEF19.png\"><img decoding=\"async\" title=\"clip_image001\" border=\"0\" alt=\"clip_image001\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2012\/12\/2021.clip_image001_thumb_701EEF19.png\" width=\"547\" height=\"258\" \/><\/a><\/p>\n<h3>&#160;<\/h3>\n<h3>JSON to C#\/VB.NET class conversion<\/h3>\n<p>To use this feature, just copy sample JSON text and \u201cPaste JSON As Classes\u201d inside .vb or .cs file. This feature uses Newtonsoft JSON parser to parse JSON text from clipboard. Once Newtonsoft JSON parser validates the clipboard data as valid JSON, then it will be converted into C# or VB.NET class depending on the selected file type. <\/p>\n<p>JSON to Classes Conversion rules<\/p>\n<ol>\n<li>Outermost class name is always Rootobject.<\/li>\n<li>All classes and properties are public.<\/li>\n<li>If property is a keyword in C#\/VB.NET then it will be prepended with _ (underscore). <\/li>\n<li>If property is number then it will be converted to int\/float\/double\/Single type<\/li>\n<li>JSON string is converted to string in C# and String in VB.NET<\/li>\n<li>Boolean data types are converted to bool in C# and Boolean in VB.NET<\/li>\n<li>If JSON text in clipboard is array of multiple JSON objects and for given property if value is null in one object and value is supported type in another then it will be marked as nullable type.<\/li>\n<li>With single JSON object, nullable data type will not be emitted. <\/li>\n<\/ol>\n<p>Let\u2019s look at some examples:<\/p>\n<pre class=\"code\"><span style=\"background: white;color: black\">{\r\n    <\/span><span>&quot;link<span>&quot;<\/span><\/span><span style=\"background: white;color: black\">: <span>&quot;<\/span><\/span><span><a href=\"http:\/\/www.microsoft.com\/Surface\/en-US\">http:\/\/www.microsoft.com\/Surface\/en-US<\/a><span>&quot;<\/span><\/span><span style=\"background: white;color: black\">, <\/span><span style=\"background: white;color: green\">\/*Awesome*\/\r\n    <\/span><span>&quot;virtual&quot;<\/span><span style=\"background: white;color: black\">: <\/span><span>&quot;Virtual Keyboard&quot;<\/span><span style=\"background: white;color: black\">,\r\n    <\/span><span>&quot;partial&quot;<\/span><span style=\"background: white;color: black\">: <\/span><span>&quot; The magnesium panels are finished with partial vapor deposition&quot;<\/span><span style=\"background: white;color: black\">,\r\n    <\/span><span>&quot;Price&quot;<\/span><span style=\"background: white;color: black\">: 499.99,\r\n    <\/span><span>&quot;title&quot;<\/span><span style=\"background: white;color: black\">: <\/span><span>&quot;Microsoft Surface&quot;<\/span><span style=\"background: white;color: black\">,\r\n    <\/span><span>&quot;\u0936\u0940\u0930\u094d\u0937\u0915&quot;<\/span><span style=\"background: white;color: black\">: <\/span><span>&quot;\u092e\u093e\u0907\u0915\u094d\u0930\u094b\u0938\u0949\u092b\u094d\u091f \u0938\u0930\u092b\u0947\u0938&quot;<\/span><span style=\"background: white;color: black\">,\r\n    <\/span><span>&quot;Like&quot;<\/span><span style=\"background: white;color: black\">: <\/span><span style=\"background: white;color: blue\">true<\/span><span style=\"background: white;color: black\">,\r\n    <\/span><span>&quot;cdDrive&quot;<\/span><span style=\"background: white;color: black\">:<\/span><span style=\"background: white;color: blue\">null<\/span><span style=\"background: white;color: black\">,\r\n}<\/span><\/pre>\n<p>C# class for above JSON object will look like below.<\/p>\n<pre class=\"code\"><span style=\"background: white;color: blue\">public class <\/span><span>Rootobject\r\n<\/span><span style=\"background: white;color: black\">{\r\n    <\/span><span style=\"background: white;color: blue\">public string <\/span><span style=\"background: white;color: black\">link { <\/span><span style=\"background: white;color: blue\">get<\/span><span style=\"background: white;color: black\">; <\/span><span style=\"background: white;color: blue\">set<\/span><span style=\"background: white;color: black\">; }\r\n    <\/span><span style=\"background: white;color: blue\">public string <\/span><span style=\"background: white;color: black\">_virtual { <\/span><span style=\"background: white;color: blue\">get<\/span><span style=\"background: white;color: black\">; <\/span><span style=\"background: white;color: blue\">set<\/span><span style=\"background: white;color: black\">; }\r\n    <\/span><span style=\"background: white;color: blue\">public string <\/span><span style=\"background: white;color: black\">partial { <\/span><span style=\"background: white;color: blue\">get<\/span><span style=\"background: white;color: black\">; <\/span><span style=\"background: white;color: blue\">set<\/span><span style=\"background: white;color: black\">; }\r\n    <\/span><span style=\"background: white;color: blue\">public float <\/span><span style=\"background: white;color: black\">Price { <\/span><span style=\"background: white;color: blue\">get<\/span><span style=\"background: white;color: black\">; <\/span><span style=\"background: white;color: blue\">set<\/span><span style=\"background: white;color: black\">; }\r\n    <\/span><span style=\"background: white;color: blue\">public string <\/span><span style=\"background: white;color: black\">title { <\/span><span style=\"background: white;color: blue\">get<\/span><span style=\"background: white;color: black\">; <\/span><span style=\"background: white;color: blue\">set<\/span><span style=\"background: white;color: black\">; }\r\n    <\/span><span style=\"background: white;color: blue\">public string <\/span><span style=\"background: white;color: black\">\u0936\u0940\u0930\u094d\u0937\u0915 { <\/span><span style=\"background: white;color: blue\">get<\/span><span style=\"background: white;color: black\">; <\/span><span style=\"background: white;color: blue\">set<\/span><span style=\"background: white;color: black\">; }\r\n    <\/span><span style=\"background: white;color: blue\">public bool <\/span><span style=\"background: white;color: black\">Like { <\/span><span style=\"background: white;color: blue\">get<\/span><span style=\"background: white;color: black\">; <\/span><span style=\"background: white;color: blue\">set<\/span><span style=\"background: white;color: black\">; }\r\n    <\/span><span style=\"background: white;color: blue\">public object <\/span><span style=\"background: white;color: black\">cdDrive { <\/span><span style=\"background: white;color: blue\">get<\/span><span style=\"background: white;color: black\">; <\/span><span style=\"background: white;color: blue\">set<\/span><span style=\"background: white;color: black\">; }\r\n}\r\n<\/span><\/pre>\n<p>VB.NET class will be like below<\/p>\n<pre class=\"code\"><span style=\"background: white;color: blue\">Public Class <\/span><span>Rootobject\r\n    <\/span><span style=\"background: white;color: blue\">Public <\/span><span style=\"background: white;color: black\">link <\/span><span style=\"background: white;color: blue\">As String\r\n    Public <\/span><span style=\"background: white;color: black\">virtual <\/span><span style=\"background: white;color: blue\">As String\r\n    Public <\/span><span style=\"background: white;color: black\">_partial <\/span><span style=\"background: white;color: blue\">As String\r\n    Public <\/span><span style=\"background: white;color: black\">Price <\/span><span style=\"background: white;color: blue\">As Single\r\n    Public <\/span><span style=\"background: white;color: black\">title <\/span><span style=\"background: white;color: blue\">As String\r\n    Public <\/span><span style=\"background: white;color: black\">\u0936\u0940\u0930\u094d\u0937\u0915 <\/span><span style=\"background: white;color: blue\">As String\r\n    Public <\/span><span style=\"background: white;color: black\">_Like <\/span><span style=\"background: white;color: blue\">As Boolean\r\n    Public <\/span><span style=\"background: white;color: black\">cdDrive <\/span><span style=\"background: white;color: blue\">As Object\r\nEnd Class<\/span><\/pre>\n<h3>DateTime Formats<\/h3>\n<p>JSON parser recognizes some DateTime formats as valid DateTime data types and some are not.<\/p>\n<p>Below JSON object has some valid DateTime data and some invalid DateTime data types<\/p>\n<pre class=\"code\"><span style=\"background: white;color: black\">[\r\n {\r\n    <\/span><span>&quot;DateTimeValid&quot;<\/span><span style=\"background: white;color: black\">: <\/span><span>&quot;2012-05-03T00:06:00.638Z&quot;<\/span><span style=\"background: white;color: black\">,\r\n    <\/span><span>&quot;NullableDateTime&quot;<\/span><span style=\"background: white;color: black\">: <\/span><span style=\"background: white;color: blue\">null<\/span><span style=\"background: white;color: black\">,\r\n    <\/span><span>&quot;DateTimeToString&quot;<\/span><span style=\"background: white;color: black\">: <\/span><span>&quot;2009-07-31T00:00Z&quot;<\/span><span style=\"background: white;color: black\">,\r\n    <\/span><span>&quot;DateTimeToObject&quot;<\/span><span style=\"background: white;color: black\">: <\/span><span>&quot;2012-05-03T00:06:00.638Z&quot;<\/span><span style=\"background: white;color: black\">,\r\n },\r\n {\r\n    <\/span><span>&quot;DateTimeValid&quot;<\/span><span style=\"background: white;color: black\">: <\/span><span>&quot;2012-05-03T00:06:00Z&quot;<\/span><span style=\"background: white;color: black\">,\r\n    <\/span><span>&quot;NullableDateTime&quot;<\/span><span style=\"background: white;color: black\">: <\/span><span>&quot;2012-05-03T00:06:00.638Z&quot;<\/span><span style=\"background: white;color: black\">,\r\n    <\/span><span>&quot;DateTimeToString&quot;<\/span><span style=\"background: white;color: black\">: <\/span><span>&quot;2009-07-31T00:00Z&quot;<\/span><span style=\"background: white;color: black\">,\r\n    <\/span><span>&quot;DateTimeToObject&quot;<\/span><span style=\"background: white;color: black\">: <\/span><span>&quot;2012-05-03T00:06&quot;<\/span><span style=\"background: white;color: black\">,\r\n }\r\n]<\/span><\/pre>\n<p>C# class for above JSON object will look like below.<\/p>\n<p><pre class=\"code\"><span style=\"background: white;color: blue\">public class <\/span><span>Rootobject\r\n<\/span><span style=\"background: white;color: black\">{\r\n    <\/span><span style=\"background: white;color: blue\">public <\/span><span>Class1<\/span><span style=\"background: white;color: black\">[] Property1 { <\/span><span style=\"background: white;color: blue\">get<\/span><span style=\"background: white;color: black\">; <\/span><span style=\"background: white;color: blue\">set<\/span><span style=\"background: white;color: black\">; }\r\n}\r\n\r\n<\/span><span style=\"background: white;color: blue\">public class <\/span><span>Class1\r\n<\/span><span style=\"background: white;color: black\">{\r\n    <\/span><span style=\"background: white;color: blue\">public <\/span><span>DateTime <\/span><span style=\"background: white;color: black\">DateTimeValid { <\/span><span style=\"background: white;color: blue\">get<\/span><span style=\"background: white;color: black\">; <\/span><span style=\"background: white;color: blue\">set<\/span><span style=\"background: white;color: black\">; }\r\n    <\/span><span style=\"background: white;color: blue\">public <\/span><span>DateTime<\/span><span style=\"background: white;color: black\">? NullableDateTime { <\/span><span style=\"background: white;color: blue\">get<\/span><span style=\"background: white;color: black\">; <\/span><span style=\"background: white;color: blue\">set<\/span><span style=\"background: white;color: black\">; }\r\n    <\/span><span style=\"background: white;color: blue\">public string <\/span><span style=\"background: white;color: black\">DateTimeToString { <\/span><span style=\"background: white;color: blue\">get<\/span><span style=\"background: white;color: black\">; <\/span><span style=\"background: white;color: blue\">set<\/span><span style=\"background: white;color: black\">; }\r\n    <\/span><span style=\"background: white;color: blue\">public object <\/span><span style=\"background: white;color: black\">DateTimeToObject { <\/span><span style=\"background: white;color: blue\">get<\/span><span style=\"background: white;color: black\">; <\/span><span style=\"background: white;color: blue\">set<\/span><span style=\"background: white;color: black\">; }\r\n}<\/span><\/pre>\n<\/p>\n<p>First two properties of Class1 are valid DateTime objects, 3<sup>rd<\/sup> property is deemed as string as the DateTime format is not valid\/recognized. Last property is converted as object as one object in array is valid DateTime and other object in array is invalid DateTime object. So property type cannot be DateTime nor can be string. Common base type for string and DateTime is object.<\/p>\n<h3>Single Dimensional Arrays<\/h3>\n<p>JSON Arrays are represented with [ ] notation in C# and with () in VB. Example as below.<\/p>\n<pre class=\"code\"><span style=\"background: white;color: black\">[\r\n {\r\n    <\/span><span>&quot;Name&quot;<\/span><span style=\"background: white;color: black\">: <\/span><span>&quot;Kamal, Employee&quot;<\/span><span style=\"background: white;color: black\">,\r\n    <\/span><span>&quot;Manager&quot;<\/span><span style=\"background: white;color: black\">: \r\n        {\r\n            <\/span><span>&quot;Name&quot;<\/span><span style=\"background: white;color: black\">: <\/span><span>&quot;Barry, Manager&quot;\r\n        <\/span><span style=\"background: white;color: black\">}\r\n },\r\n {\r\n    <\/span><span>&quot;Name&quot;<\/span><span style=\"background: white;color: black\">: <\/span><span>&quot;Barry, Manager&quot;\r\n <\/span><span style=\"background: white;color: black\">}\r\n]\r\n<\/span><\/pre>\n<p>C# class for above JSON object will look like below.<\/p>\n<pre class=\"code\"><span style=\"background: white;color: blue\">public class <\/span><span>Rootobject\r\n<\/span><span style=\"background: white;color: black\">{\r\n    <\/span><span style=\"background: white;color: blue\">public <\/span><span>Class1<\/span><span style=\"background: white;color: black\">[] Property1 { <\/span><span style=\"background: white;color: blue\">get<\/span><span style=\"background: white;color: black\">; <\/span><span style=\"background: white;color: blue\">set<\/span><span style=\"background: white;color: black\">; }\r\n}\r\n\r\n<\/span><span style=\"background: white;color: blue\">public class <\/span><span>Class1\r\n<\/span><span style=\"background: white;color: black\">{\r\n    <\/span><span style=\"background: white;color: blue\">public string <\/span><span style=\"background: white;color: black\">Name { <\/span><span style=\"background: white;color: blue\">get<\/span><span style=\"background: white;color: black\">; <\/span><span style=\"background: white;color: blue\">set<\/span><span style=\"background: white;color: black\">; }\r\n    <\/span><span style=\"background: white;color: blue\">public <\/span><span>Manager <\/span><span style=\"background: white;color: black\">Manager { <\/span><span style=\"background: white;color: blue\">get<\/span><span style=\"background: white;color: black\">; <\/span><span style=\"background: white;color: blue\">set<\/span><span style=\"background: white;color: black\">; }\r\n}\r\n\r\n<\/span><span style=\"background: white;color: blue\">public class <\/span><span>Manager\r\n<\/span><span style=\"background: white;color: black\">{\r\n    <\/span><span style=\"background: white;color: blue\">public string <\/span><span style=\"background: white;color: black\">Name { <\/span><span style=\"background: white;color: blue\">get<\/span><span style=\"background: white;color: black\">; <\/span><span style=\"background: white;color: blue\">set<\/span><span style=\"background: white;color: black\">; }\r\n}\r\n<\/span><\/pre>\n<p>VB. NET class as below<\/p>\n<pre class=\"code\"><span style=\"background: white;color: blue\">Public Class <\/span><span>Rootobject\r\n    <\/span><span style=\"background: white;color: blue\">Public <\/span><span style=\"background: white;color: black\">Property1() <\/span><span style=\"background: white;color: blue\">As <\/span><span style=\"background: white;color: black\">Class1\r\n<\/span><span style=\"background: white;color: blue\">End Class\r\n\r\nPublic Class <\/span><span>Class1\r\n    <\/span><span style=\"background: white;color: blue\">Public <\/span><span style=\"background: white;color: black\">Name <\/span><span style=\"background: white;color: blue\">As String\r\n    Public <\/span><span style=\"background: white;color: black\">Manager <\/span><span style=\"background: white;color: blue\">As <\/span><span style=\"background: white;color: black\">Manager\r\n<\/span><span style=\"background: white;color: blue\">End Class\r\n\r\nPublic Class <\/span><span>Manager\r\n    <\/span><span style=\"background: white;color: blue\">Public <\/span><span style=\"background: white;color: black\">Name <\/span><span style=\"background: white;color: blue\">As String\r\nEnd Class\r\n<\/span><\/pre>\n<p>&#160;<\/p>\n<h3>Multi-Dimensional Arrays<\/h3>\n<p>You can convert multi-dimension JSON arrays to classes. JSON Example for two dimensional array: <\/p>\n<p>[ [ 1, 2, 3 ] ]<\/p>\n<p>C# class for above JSON object will look like below: <\/p>\n<pre class=\"code\"><span style=\"background: white;color: blue\">public class <\/span><span>Rootobject\r\n<\/span><span style=\"background: white;color: black\">{\r\n    <\/span><span style=\"background: white;color: blue\">public int<\/span><span style=\"background: white;color: black\">[][] Property1 { <\/span><span style=\"background: white;color: blue\">get<\/span><span style=\"background: white;color: black\">; <\/span><span style=\"background: white;color: blue\">set<\/span><span style=\"background: white;color: black\">; }\r\n}\r\n<\/span><\/pre>\n<p>VB.NET class: <\/p>\n<pre class=\"code\"><span style=\"background: white;color: blue\">Public Class <\/span><span>Rootobject\r\n    <\/span><span style=\"background: white;color: blue\">Public <\/span><span style=\"background: white;color: black\">Property1()() <\/span><span style=\"background: white;color: blue\">As Integer\r\nEnd Class\r\n<\/span><\/pre>\n<p>Also you can convert JSON with objects having arrays inside array as shown in the example below<\/p>\n<pre class=\"code\"><span style=\"background: white;color: black\">{\r\n    <\/span><span>&quot;results&quot;<\/span><span style=\"background: white;color: black\">: \r\n    [{\r\n        <\/span><span>&quot;address_Office&quot;<\/span><span style=\"background: white;color: black\">: \r\n        [{\r\n            <\/span><span>&quot;street_number&quot;<\/span><span style=\"background: white;color: black\">: <\/span><span>&quot;One&quot;<\/span><span style=\"background: white;color: black\">,\r\n            <\/span><span>&quot;city_name&quot;<\/span><span style=\"background: white;color: black\">: <\/span><span>&quot;Bellevue&quot;<\/span><span style=\"background: white;color: black\">,\r\n            <\/span><span>&quot;state_name&quot;<\/span><span style=\"background: white;color: black\">: <\/span><span>&quot;Washington&quot;<\/span><span style=\"background: white;color: black\">,\r\n            <\/span><span>&quot;street_name&quot;<\/span><span style=\"background: white;color: black\">: [ <\/span><span>&quot;Microsoft Way&quot; <\/span><span style=\"background: white;color: black\">]\r\n        }],\r\n    }]\r\n}\r\n<\/span><\/pre>\n<p>C# class for above JSON object will look like below:<\/p>\n<pre class=\"code\"><span style=\"background: white;color: blue\">public class <\/span><span>Rootobject\r\n<\/span><span style=\"background: white;color: black\">{\r\n    <\/span><span style=\"background: white;color: blue\">public <\/span><span>Result<\/span><span style=\"background: white;color: black\">[] results { <\/span><span style=\"background: white;color: blue\">get<\/span><span style=\"background: white;color: black\">; <\/span><span style=\"background: white;color: blue\">set<\/span><span style=\"background: white;color: black\">; }\r\n}\r\n\r\n<\/span><span style=\"background: white;color: blue\">public class <\/span><span>Result\r\n<\/span><span style=\"background: white;color: black\">{\r\n    <\/span><span style=\"background: white;color: blue\">public <\/span><span>Address_Office<\/span><span style=\"background: white;color: black\">[] address_Office { <\/span><span style=\"background: white;color: blue\">get<\/span><span style=\"background: white;color: black\">; <\/span><span style=\"background: white;color: blue\">set<\/span><span style=\"background: white;color: black\">; }\r\n}\r\n\r\n<\/span><span style=\"background: white;color: blue\">public class <\/span><span>Address_Office\r\n<\/span><span style=\"background: white;color: black\">{\r\n    <\/span><span style=\"background: white;color: blue\">public string <\/span><span style=\"background: white;color: black\">street_number { <\/span><span style=\"background: white;color: blue\">get<\/span><span style=\"background: white;color: black\">; <\/span><span style=\"background: white;color: blue\">set<\/span><span style=\"background: white;color: black\">; }\r\n    <\/span><span style=\"background: white;color: blue\">public string <\/span><span style=\"background: white;color: black\">city_name { <\/span><span style=\"background: white;color: blue\">get<\/span><span style=\"background: white;color: black\">; <\/span><span style=\"background: white;color: blue\">set<\/span><span style=\"background: white;color: black\">; }\r\n    <\/span><span style=\"background: white;color: blue\">public string <\/span><span style=\"background: white;color: black\">state_name { <\/span><span style=\"background: white;color: blue\">get<\/span><span style=\"background: white;color: black\">; <\/span><span style=\"background: white;color: blue\">set<\/span><span style=\"background: white;color: black\">; }\r\n    <\/span><span style=\"background: white;color: blue\">public string<\/span><span style=\"background: white;color: black\">[] street_name { <\/span><span style=\"background: white;color: blue\">get<\/span><span style=\"background: white;color: black\">; <\/span><span style=\"background: white;color: blue\">set<\/span><span style=\"background: white;color: black\">; }\r\n}\r\n<\/span><\/pre>\n<p>VB.NET class:<\/p>\n<pre class=\"code\"><span style=\"background: white;color: blue\">Public Class <\/span><span>Rootobject\r\n    <\/span><span style=\"background: white;color: blue\">Public <\/span><span style=\"background: white;color: black\">results() <\/span><span style=\"background: white;color: blue\">As <\/span><span style=\"background: white;color: black\">Result\r\n<\/span><span style=\"background: white;color: blue\">End Class\r\n\r\nPublic Class <\/span><span>Result\r\n    <\/span><span style=\"background: white;color: blue\">Public <\/span><span style=\"background: white;color: black\">address_Office() <\/span><span style=\"background: white;color: blue\">As <\/span><span style=\"background: white;color: black\">Address_Office\r\n<\/span><span style=\"background: white;color: blue\">End Class\r\n\r\nPublic Class <\/span><span>Address_Office\r\n    <\/span><span style=\"background: white;color: blue\">Public <\/span><span style=\"background: white;color: black\">street_number <\/span><span style=\"background: white;color: blue\">As String\r\n    Public <\/span><span style=\"background: white;color: black\">city_name <\/span><span style=\"background: white;color: blue\">As String\r\n    Public <\/span><span style=\"background: white;color: black\">state_name <\/span><span style=\"background: white;color: blue\">As String\r\n    Public <\/span><span style=\"background: white;color: black\">street_name() <\/span><span style=\"background: white;color: blue\">As String\r\nEnd Class\r\n<\/span><\/pre>\n<h3>Troubleshooting<\/h3>\n<p>If JSON Object in clipboard is invalid, error message will be shown with the reason.<\/p>\n<p>Example: Below JSON object contains max value for decimal data type. Newtonsoft JSON Parser does not recognize values above 1.7976931348623157E+308(which is max value for double data type). <\/p>\n<pre class=\"code\"><span style=\"background: white;color: black\">{\r\n    <\/span><span>&quot;DecimalMax&quot;<\/span><span style=\"background: white;color: black\">: 1.79769313486232E+308,\r\n}<\/span><\/pre>\n<p>This will result in error like below when \u201c<i>Paste JSON As Classes<\/i>\u201d is called. <\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2012\/12\/6724.clip_image002_thumb_5DD62857.png\"><img decoding=\"async\" title=\"clip_image002\" border=\"0\" alt=\"clip_image002\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2012\/12\/6724.clip_image002_thumb_5DD62857.png\" width=\"496\" height=\"223\" \/><\/a><\/p>\n<p>Another example of invalid JSON object where \u201c\u201d are not valid character:<\/p>\n<pre class=\"code\"><span style=\"background: white;color: black\">{<\/span><span>&quot;login&quot;<\/span><span style=\"background: white;color: black\">:\u201d\u201d;}<\/span><\/pre>\n<p>This will result in error like below when \u201c<i>Paste JSON As Classes<\/i>\u201d is called.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2012\/12\/0451.clip_image003_thumb_28C99927.png\"><img decoding=\"async\" title=\"clip_image003\" border=\"0\" alt=\"clip_image003\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2012\/12\/0451.clip_image003_thumb_28C99927.png\" width=\"494\" height=\"236\" \/><\/a><\/p>\n<p><a><\/a><\/p>\n<p>Thank you for your time reading this blog post. Looking forward to hear your feedback on this feature!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u2018Paste JSON As Classes\u2019 is a cool feature in ASP.NET and Web Tools 2012.2 RC. This feature will help you generate strongly typed classes in C# or VB.NET from valid JSON text. With ASP.NET and Web Tools 2012.2 RC installed, you will see new menu option like below for C# and VB.NET Website and Web [&hellip;]<\/p>\n","protected":false},"author":452,"featured_media":58792,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[197],"tags":[31,46,7262,7426,7369,144,7412,7319,7267],"class_list":["post-1934","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-aspnet","tag-asp-net","tag-c","tag-development","tag-json","tag-tools","tag-vb","tag-visual-studio-2012","tag-visual-web-developer","tag-vwd"],"acf":[],"blog_post_summary":"<p>\u2018Paste JSON As Classes\u2019 is a cool feature in ASP.NET and Web Tools 2012.2 RC. This feature will help you generate strongly typed classes in C# or VB.NET from valid JSON text. With ASP.NET and Web Tools 2012.2 RC installed, you will see new menu option like below for C# and VB.NET Website and Web [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/1934","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/users\/452"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/comments?post=1934"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/1934\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media\/58792"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media?parent=1934"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/categories?post=1934"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/tags?post=1934"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}