Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

c# write to file in json

//if you want to use a list and add it to a file in json do this
using System.IO;
using System.Text.Json;

List<Data> data = new List<Data>();
  public void SaveData()
        {
            using (StreamWriter sw = File.CreateText("data.json"))
            {
                sw.Write(JsonSerializer.Serialize(data));
            }
        }
 
PREVIOUS NEXT
Tagged: #write #file #json
ADD COMMENT
Topic
Name
9+5 =