This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Newtonsoft.Json; | |
using Newtonsoft.Json.Linq; | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
ObjectSet obj = new ObjectSet(); | |
obj.sysname = "sample"; | |
obj.url = "http://www.google.com"; | |
obj.Account = "asdf"; | |
obj.Password = "1234"; | |
string line = JsonConvert.SerializeObject(obj); | |
Console.WriteLine(line); | |
ObjectSet deobj = JsonConvert.DeserializeObject<ObjectSet>(line); | |
Console.WriteLine("Account:"+deobj.Account); | |
Console.WriteLine("Password:"+deobj.Password); | |
} | |
} | |
public class ObjectSet | |
{ | |
public string sysname; | |
public string url; | |
public string Account; | |
public string Password; | |
} | |