C#C
C#3y ago
4 replies
entasy

❔ Convert JSON string to struct

I have a string in JSON format. How can I convert it to a struct?
public struct config
{
    public string ip { get; set; }
    public int port { get; set; }
}

string _data = @"{""ip"":""127.0.0.1"",""port"":12345""}"; // I want to convert it to a config struct.
Was this page helpful?