c# object to json string
Newtonsoft.Json.JsonConvert.SerializeObject(new {foo = "bar"})var json = new JavaScriptSerializer().Serialize(obj);using System;
using System.Web.Script.Serialization;
public class MyDate
{
public int year;
public int month;
public int day;
}
public class Lad
{
public string firstName;
public string lastName;
public MyDate dateOfBirth;
}
class Program
{
static void Main()
{
var obj = new Lad
{
firstName = "Markoff",
lastName = "Chaney",
dateOfBirth = new MyDate
{
year = 1901,
month = 4,
day = 30
}
};
var json = new JavaScriptSerializer().Serialize(obj);
Console.WriteLine(json);
}
}
Also in C#:
- top down movement unity
- how to hide and show object in unity script
- c# making a folder
- texture to image unity
- gfortran: declare an array
- disable mouse unity
- visual studio C# hintergrund bild ändern
- dontdestroyonload unity
- c# clone stream
- get hash c#
- c# sort array
- c# build string out of list of strings
- download file from url asp net web api c#
- c# how to add newline on text box
- git set origin
- convert string to decimal c#
- unity3d get component
- what type of variable is true or false in c#
- c# return multiple value unity
- internal c#
- unity set material color
- c# webrequest cookies
- loop through string array c#
- 2d object look at object