JSON (edit)
https://viblo.asia/p/jsonparse-and-jsonstringify-oOVlYWwyK8W
const myObj = {
name: 'Sy Dinh',
age: 22,
social: 'https://sydinh.com/',
};
const myObjStr = JSON.stringify(myObj);
console.log(myObjStr);
// JSON "{"name":"Sy Dinh","age":22,"social":"https://sydinh.com/"}"
console.log(JSON.parse(myObjStr));
// Object {name: "Sy Dinh", age: 22, social: "https://sydinh.com/"}
https://stackoverflow.com/questions/1056121/how-to-create-json-string-in-c-sharp
https://www.c-sharpcorner.com/article/working-with-json-string-in-C-Sharp/
http://antonkallenberg.com/2015/03/13/json-net-case-insensitive-dictionary/
https://completejavascript.com/tim-hieu-ve-json-trong-javascript/
const string = JSON.stringify({name: "X", born: 1990}); console.log(string); // => {"name":"X","born":1990} const obj = JSON.parse(string); console.log(obj.name); // => X console.log(obj.born); // => 1990
List<Person> people = new List<Person>
{
new Person{ID = 1, FirstName = "Scott", LastName = "Gurthie"},
new Person{ID = 2, FirstName = "Bill", LastName = "Gates"}
};
string jsonString = people.ToJSON();
string jsonData = Newtonsoft.Json.JsonConvert.SerializeObject(people[0]);
var details = Newtonsoft.Json.Linq.JObject.Parse(jsonData);
Console.WriteLine(string.Concat("Hi ", details["FirstName"], " " + details["LastName"]));
var person = Newtonsoft.Json.JsonConvert.DeserializeObject<Person>(jsonData);
Console.WriteLine(string.Concat("Hi ", person.FirstName, " " + person.LastName));