Using a JSON file from a Discord bot in a C# application

I’m developing a Windows Forms application in C# using Visual Studio 2015 and I need assistance accessing a JSON file generated by my Discord bot. The file looks like this:

{
    "223800261297176576": {
        "129592273850597376": {
            "balance": 750,
            "created_at": "2016-10-08 18:00:53",
            "name": "Nathiri"
        },
        "180444644650385409": {
            "balance": 950,
            "created_at": "2016-11-01 14:55:11",
            "name": "WAC"
        }
    }
}

My goal is to read this file within my WinForms application and automatically fill in various fields in the form with the information contained in it. If anyone has any guidance on how to deserialize this JSON file and bind it to my form fields, I would really appreciate the help. Thanks!

Use System.Text.Json - it’s built into newer .NET versions. Make a simple model class with Balance, CreatedAt, and Name properties for your user data. Then JsonSerializer.Deserialize converts your file into a Dictionary<string, Dictionary<string, UserData>>. Outer keys are server IDs, inner keys are user IDs. After that, just loop through the nested dictionaries and fill your form controls. Match property names to control names or use a switch statement. Clean code, no external dependencies, and it’ll handle typical Discord bot data sizes just fine.

I’ve dealt with this kind of nested JSON before - it’s tricky at first. Since you’ve got dynamic keys (those user IDs), don’t bother with strongly-typed classes for the outer stuff. What worked for me was using JObject from Newtonsoft.Json to parse it first, then pull out the nested data programmatically. Just load it with JObject.Parse() and navigate through with indexers. For your form binding, extract the user data into something cleaner first - maybe a List of custom objects. Way easier than trying to bind that messy nested dictionary straight to your controls. Discord IDs change, so this keeps things flexible instead of locking you into rigid class structures.

totally agree, Newtonsoft.Json is the way to go! u just need to convert it into a Dictionary<string, Dictionary<string, UserData>>. UserData should have properties like balance, created_at, and name. Once you got it, simply iterate to fill your forms. good luck!

Been there with Discord bot data integration. Manual parsing works but gets messy when your JSON structure changes or you need regular syncing.

I solved this by setting up an automated pipeline for the entire flow. Instead of writing custom deserialization code every time, I built a workflow that monitors the Discord bot’s JSON output, transforms it to match my WinForms app format, and pushes it straight to the form fields.

When Discord changes their data structure or you add new fields, just update the transformation logic once. No more recompiling your C# app or dealing with parsing errors.

If you want real-time updates or data validation later, everything’s already set up. Way more reliable than manual file reading.

Here’s how to build this kind of automated data pipeline: https://latenode.com