Answer the question
In order to leave comments, you need to log in
How to get content from variable in json C#?
I use (Newtonsoft.Json)
I have a Delo class which describes Json File
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TestArea
{
public class Delo
{
public string Name { get; set; }
public string Podpis { get; set; }
public int Number { get; set; }
}
}
{"Name":"vasya","Podpis":"rar","Number":0}
string temp1 = File.ReadAllText("info.json");
JsonConvert.DeserializeObject<Delo>(temp1);
// просто в обращении к temp1. (name не существует), а в классе он есть.
Answer the question
In order to leave comments, you need to log in
var text = File.ReadAllText("info.json");
var delo = JsonConvert.DeserializeObject<Delo>(text);
Console.WriteLine(delo.Name);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question