Skip to content

Instantly share code, notes, and snippets.

@ertugrulozcan
Created December 7, 2016 09:05
Show Gist options
  • Save ertugrulozcan/5ed51a3a81817b8add8b24e9d3a2ec36 to your computer and use it in GitHub Desktop.
Save ertugrulozcan/5ed51a3a81817b8add8b24e9d3a2ec36 to your computer and use it in GitHub Desktop.
"CompanyList" : [
{
"Name": "Optiim",
"Address": "Blablala",
"PhoneNumber": "0123456789",
},
{
"Name": "Matriks",
"Address": "Blablala",
"PhoneNumber": "0123456789",
}]
// Ornek Company sinifi boyle olsun;
public class Company
{
public string Name { get; set; }
public string Address { get; set; }
public string PhoneNumber { get; set; }
}
// ...
// GetCompanyListJson() metodu json string'ini veriyor olsun.
string jsonStr = GetCompanyListJson();
// Json'dan listeye boyle donusturulur;
List<Company> companyList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Company>>(jsonStr);
// Object'den Json uretmek şstersen de;
string jsonStr2 = Newtonsoft.Json.JsonConvert.SerializeObject(companyList);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment