Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

Write JSON file C#

using System.Text.Json;
using System.Text.Json.Serialization;

List<data> _data = new List<data>();
_data.Add(new data()
{
    Id = 1,
    SSN = 2,
    Message = "A Message"
});

string json = JsonSerializer.Serialize(_data);
File.WriteAllText(@"D:path.json", json);
Comment

how to create json file in c#

//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);
}
Comment

how to create json file in c#

            File.Create(@"details.json");
Comment

PREVIOUS NEXT
Code Example
Javascript :: javscript match word in string 
Javascript :: javascript remove string between 
Javascript :: ordenar un array de menor a mayor 
Javascript :: js int to string base 
Javascript :: webpack babel loaders/plugin installation 
Javascript :: rgb to hex conversion 
Javascript :: how to get duplicate values from array in javascript 
Javascript :: google analyics send event 
Javascript :: secure cookie in javascript 
Javascript :: change image on click javascript 
Javascript :: javascript date double digit month 
Javascript :: trigger jquery 
Javascript :: class constructor javascript 
Javascript :: javascript find object in array by property value 
Javascript :: javascript discord bot 
Javascript :: sort by date javascript 
Javascript :: angular implementing Validator 
Javascript :: add days to date javascript dd/mm/yyyy in input date 
Javascript :: pdf to json online 
Javascript :: show the time zone of browser javascript 
Javascript :: how to check if input is string javascript 
Javascript :: .fetch method 
Javascript :: nodejs end process 
Javascript :: windows scroll condition 
Javascript :: fetch api 
Javascript :: get nearest location based on latitude and longitude javascript 
Javascript :: angular convert map values to array 
Javascript :: how to get os theme value in javascript 
Javascript :: react native text align vertical center 
Javascript :: react native font awesome 
ADD CONTENT
Topic
Content
Source link
Name
7+3 =