create json string c#
//Create my object
var my_jsondata = new
{
Host = @"sftp.myhost.gr",
UserName = "my_username",
Password = "my_password",
SourceDir = "/export/zip/mypath/",
FileName = "my_file.zip"
};
//Tranform it to Json object
string json_data = JsonConvert.SerializeObject(my_jsondata);
//Print the Json object
Console.WriteLine(json_data);
//Parse the json object
JObject json_object = JObject.Parse(json_data);
//Print the parsed Json object
Console.WriteLine((string)json_object["Host"]);
Console.WriteLine((string)json_object["UserName"]);
Console.WriteLine((string)json_object["Password"]);
Console.WriteLine((string)json_object["SourceDir"]);
Console.WriteLine((string)json_object["FileName"]);
//open file stream
using (StreamWriter file = File.CreateText(@"D:\path.txt"))
{
JsonSerializer serializer = new JsonSerializer();
//serialize object directly into file stream
serializer.Serialize(file, _data);
}
Also in JavaScript:
- firebase angular send notification to by tocken
- javascript ajax post send an object
- python object to json
- javascrip reverse text
- javascript change meta tag
- document.body.style.background
- chartjs start at 0
- ternary operator react
- Javascript code for Age calculator chatbot
- how to auto refresh page in javascript
- get variable name javascript
- javascript display block
- material ui grid react
- Remove Duplicate objects from JSON
- discord bot v12 reaction remove code
- how to add button in javascript
- godot destroy node
- do i have to include jquery files at head of bootstrap
- paypal cordova can not open popup window - blocked
- refresh current component angular
- get radio button value javascript
- react native sovrapporre immagini
- filter
- javascrpt refresh page