Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

c# read json file into object

// read file into a string and deserialize JSON to a type
Movie movie1 = JsonConvert.DeserializeObject<Movie>(File.ReadAllText(@"c:movie.json"));

// deserialize JSON directly from a file
using (StreamReader file = File.OpenText(@"c:movie.json"))
{
    JsonSerializer serializer = new JsonSerializer();
    Movie movie2 = (Movie)serializer.Deserialize(file, typeof(Movie));
}
Comment

reading a json file in c#

JObject o1 = JObject.Parse(File.ReadAllText(@"c:videogames.json"));

// read JSON directly from a file
using (StreamReader file = File.OpenText(@"c:videogames.json"))
using (JsonTextReader reader = new JsonTextReader(file))
{
    JObject o2 = (JObject)JToken.ReadFrom(reader);
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: unity scriptable object 
Csharp :: c# log to console 
Csharp :: random value in array c# 
Csharp :: unity spawn object at position 
Csharp :: move in the direction that player is facing unity 
Csharp :: unity print 
Csharp :: c# how to add newline on text box 
Csharp :: get random number c# 
Csharp :: c# form formborderstyle none move 
Csharp :: radians to degree c# 
Csharp :: c# empty char 
Csharp :: unity object follow mouse 
Csharp :: require admin pervillages c# 
Csharp :: how to chnage the Scale propery of rect tranform unity 
Csharp :: message box in visual studio 
Csharp :: unity move character 
Csharp :: mvc select list order by 
Csharp :: unity get direction from one point to another 
Csharp :: search the third word in string in c# 
Csharp :: change image source wpf 
Csharp :: snx turn off linux 
Csharp :: c# open file in default program 
Csharp :: remove whitespace between string c# 
Csharp :: c# add guid to array 
Csharp :: unity detect object with raycast 
Csharp :: regex replace all special characters 
Csharp :: solution to fizzbuzz c# 
Csharp :: unity gameobject to mouse 
Csharp :: how to join array indexes with comma in c# 
Csharp :: create models from database ef core 
ADD CONTENT
Topic
Content
Source link
Name
6+2 =