Download the library from http://james.newtonking.com/json

Add Newtonsoft.Json.dll to your main project directory.

Right click your project > Properties > Common Properties > Framework & References > Add new reference

Select the Browse tab and select the Newtonsoft.Json.dll file

Convert Json File To Class


using namespace Newtonsoft::Json

	//----- CLASSES FOR THE JSON DESERIALIZATION -----
	public ref class Json_global_channels
	{
		public: int channel_id;
		public: String ^channel_name;
	};
	public ref class Json_user_results					//For each sub group of json data create a new class and include it in the parent class
	{
		public: String ^valid_request;
		public: String ^password_key;
	};
	public ref class JsonRootObject
	{
		public: Json_user_results ^user_results;		//Name the object to match the name in json, in this case "user_results"
		public: array<Json_global_channels^> ^global_channels;			//Use an array (or List) for repeating json data
	};

	//UserJsonData has the json in it
	//Deserialize it:
	JsonRootObject ^MyJsonData1 = Newtonsoft::Json::JsonConvert::DeserializeObject<JsonRootObject^>(UserJsonData);

 

USEFUL?
We benefit hugely from resources on the web so we decided we should try and give back some of our knowledge and resources to the community by opening up many of our company’s internal notes and libraries through mini sites like this. We hope you find the site helpful.
Please feel free to comment if you can add help to this page or point out issues and solutions you have found, but please note that we do not provide support on this site. If you need help with a problem please use one of the many online forums.