c# json serialize
using Newtonsoft.Json;
var jsonString = JsonConvert.SerializeObject(obj);using System.Text.Json;
//Serialize
var jsonString = JsonSerializer.Serialize(yourObject);
// Deserialize
var obj = JsonSerializer.Deserialize<YourObject>(stringValue);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);
}
}string jsonString = JsonSerializer.Serialize(weatherForecast);
Also in JavaScript:
- js set cookie
- Material-ui disabled icon
- jquery how to expand select
- get only one type from json
- how to check if all inputs are not empty with javascript
- javascript hasclass
- javascript check if string contains substring
- how To clear all the input element inside div using jquery
- redux http library
- js is empty object
- js change html lang
- how to download array of files from aws s3 using aws sdk in nodejs
- javascript convert number to binary representation
- difference between foreach and map in js
- nextjs with typescrip example
- convert data into json format in javascript
- line chart using json django
- copy text on button click in jquery
- how to get time and date from iso string javascript
- js element exists
- flag deopdown material ui
- jquery set hidden field value
- jquery append table row
- como percorrer um objeto js