❔ Convert JSON string to struct

MMoonstalker1/31/2023
I have a string in JSON format. How can I convert it to a struct?
c++
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.
Tthinker2271/31/2023
You can use System.Text.Json to do the deserialization, but I'm not sure it works with structs
MMoonstalker1/31/2023
It worked, thank you. @🌈 Thinker 🌈
For anyone who needs:
c++

public struct Configdata
{
    public string ip { get; set; }
    public string port { get; set; }
}

string _data = @"{""ip"":""127.0.0.1"", ""port"":""12345""}";
var _data2 = JsonSerializer.Deserialize<Configdata>(_data);
Console.WriteLine($"Content: {_data2.ip}");
Console.WriteLine($"Content: {_data2.port}");
AAccord2/1/2023
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.