{"id":1189,"date":"2014-12-15T14:27:57","date_gmt":"2014-12-15T14:27:57","guid":{"rendered":"https:\/\/ibex.tech\/visualcpp\/?p=1189"},"modified":"2022-02-17T06:24:03","modified_gmt":"2022-02-17T06:24:03","slug":"newtonsoft-json-library","status":"publish","type":"post","link":"https:\/\/ibex.tech\/visualcpp\/json\/newtonsoft-json-library","title":{"rendered":"Newtonsoft Json Library"},"content":{"rendered":"<p>\nDownload the library from&nbsp;<a href=\"http:\/\/james.newtonking.com\/json\">http:\/\/james.newtonking.com\/json<\/a>\n<\/p>\n<p>\nAdd Newtonsoft.Json.dll to your main project directory.\n<\/p>\n<p>\nRight click your project &gt; Properties &gt; Common Properties &gt; Framework &amp; References &gt; Add new reference\n<\/p>\n<p style=\"margin-left: 40px;\">\nSelect the Browse tab and select the&nbsp;Newtonsoft.Json.dll file\n<\/p>\n<h4>\nConvert Json File To Class<br \/>\n<\/h4>\n<pre>\r\n<code>\r\nusing namespace Newtonsoft::Json\r\n\r\n\t\/\/----- CLASSES FOR THE JSON DESERIALIZATION -----\r\n\tpublic ref class Json_global_channels\r\n\t{\r\n\t\tpublic: int channel_id;\r\n\t\tpublic: String ^channel_name;\r\n\t};\r\n\tpublic ref class Json_user_results\t\t\t\t\t\/\/For each sub group of json data create a new class and include it in the parent class\r\n\t{\r\n\t\tpublic: String ^valid_request;\r\n\t\tpublic: String ^password_key;\r\n\t};\r\n\tpublic ref class JsonRootObject\r\n\t{\r\n\t\tpublic: Json_user_results ^user_results;\t\t\/\/Name the object to match the name in json, in this case &quot;user_results&quot;\r\n\t\tpublic: array&lt;Json_global_channels^&gt; ^global_channels;\t\t\t\/\/Use an array (or List) for repeating json data\r\n\t};\r\n<\/code><\/pre>\n<pre>\r\n<code>\r\n\t\/\/UserJsonData has the json in it\r\n\t\/\/Deserialize it:\r\n\tJsonRootObject ^MyJsonData1 = Newtonsoft::Json::JsonConvert::DeserializeObject&lt;JsonRootObject^&gt;(UserJsonData);\r\n<\/code><\/pre>\n<p>\n&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Download the library from&nbsp;http:\/\/james.newtonking.com\/json Add Newtonsoft.Json.dll to your main project directory. Right click your project &gt; Properties &gt; Common Properties &gt; Framework &amp; References &gt; Add new reference Select the Browse tab and select the&nbsp;Newtonsoft.Json.dll file Convert Json File To Class using namespace Newtonsoft::Json \/\/&#8212;&#8211; CLASSES FOR THE JSON DESERIALIZATION &#8212;&#8211; public ref class Json_global_channels [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[100],"tags":[],"class_list":["post-1189","post","type-post","status-publish","format-standard","hentry","category-json"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/posts\/1189","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/comments?post=1189"}],"version-history":[{"count":8,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/posts\/1189\/revisions"}],"predecessor-version":[{"id":1197,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/posts\/1189\/revisions\/1197"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/media?parent=1189"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/categories?post=1189"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/tags?post=1189"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}