Generic .Net Script

while (Console.ReadLine() is string line)
{
    var base64EncodedBytes = System.Convert.FromBase64String(line);
    var json = System.Text.Encoding.UTF8.GetString(base64EncodedBytes);
    var jsonDom = System.Text.Json.JsonSerializer.Deserialize<System.Text.Json.Nodes.JsonObject>(json)!;

    var providerRecordUid = (string)jsonDom["providerRecordUid"]!;
    var resourceRecordUid = (string)jsonDom["resourceRecordUid"]!;
    var userRecordUid = (string)jsonDom["userRecordUid"]!;
    var newPassword = (string)jsonDom["newPassword"]!;
    var oldPassword = (string)jsonDom["oldPassword"]!;
    var user = (string)jsonDom["user"]!;
    Console.WriteLine($"providerRecordUid={providerRecordUid}\n" +
        $"resourceRecordUid={resourceRecordUid}\n" +
        $"userRecordUid={userRecordUid}\n" +
        $"newPassword={newPassword}\n" +
        $"oldPassword={oldPassword}\n" +
        $"user={user}\n");

    if (jsonDom["records"] != null)
    {
        base64EncodedBytes = System.Convert.FromBase64String((string)jsonDom["records"]!);
        json = System.Text.Encoding.UTF8.GetString(base64EncodedBytes);
        var recordsDom = System.Text.Json.JsonSerializer.Deserialize<System.Text.Json.Nodes.JsonArray>(json)!;
        foreach (var item in recordsDom)
        {
            Console.WriteLine($"Title={item!["title"]}");
        }
    }
}

Last updated