-3

So I have a bot that generates this file:

"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"
    },
    "180456532083867650" : {
        "balance" : 1150,
        "created_at" : "2016-10-08 18:12:24",
        "name" : "WiNDOGE_Master"
    },
    "194634355820199936" : {
        "balance" : 0,
        "created_at" : "2016-10-16 15:07:55",
        "name" : "DogeBot"
    },
    "195889991073660929" : {
        "balance" : 750,
        "created_at" : "2016-10-24 18:47:25",
        "name" : "Mikey"
    },
    "218499966652383232" : {
        "balance" : 1250,
        "created_at" : "2016-10-02 17:29:18",
        "name" : "[CDHG]PhoenixDeFalco"
    },
    "223084038846545920" : {
        "balance" : 300,
        "created_at" : "2016-10-11 19:24:36",
        "name" : "spyty06"
    },
    "228987707571830784" : {
        "balance" : 700,
        "created_at" : "2016-10-11 16:06:13",
        "name" : "[CDHG]CarrieDeFalco"
    },
    "229026428706881537" : {
        "balance" : 500,
        "created_at" : "2016-10-02 17:40:16",
        "name" : "[CDHG] commander spyty06"
    },
    "229347464065449984" : {
        "balance" : 750,
        "created_at" : "2016-10-29 20:24:44",
        "name" : "FaZe King"
    },
    "238783223965024273" : {
        "balance" : 750,
        "created_at" : "2016-10-25 18:40:11",
        "name" : "[CDHG]JacenDeFalco"
    },
    "242017771200708609" : {
        "balance" : 1845,
        "created_at" : "2016-10-29 20:21:27",
        "name" : "StarRoseDeFalco"
    }
}

My question is, how do I get a C# Windows Forms Application in Visual Studio 2015 to read this file and use the information in it to alter the various fields in the form automatically? This is what the form looks like.

If anyone could help me make the program read the .json and use it as data to put into the boxes on the form, I would be very grateful...Thanks so much!

  • What have you tried? SO is not a code writing service. Please read http://stackoverflow.com/help/how-to-ask – itsme86 Nov 28 '16 at 15:47
  • @itsme86 I've tried to get it to read the file by `using bank.json`, i tried `import bank.json`, and I've also tried copying the code from `bank.json` directly into the form1.cs code file...nothing has worked...I'm officially stumped. – PhoenixDeFalco Nov 28 '16 at 15:50

2 Answers2

1

first convert the Json to xml

 XmlDocument doc = JsonConvert.DeserializeXmlNode(json);

then use XmlElement, to start working with the data itself.

Bernard Walters
  • 391
  • 1
  • 4
  • 16
1

you can transform in a object then show in your form. Here how to transform your json in a object

Deserialize JSON into C# dynamic object?

Community
  • 1
  • 1