Jump to content

Question about the Backpack API (need help with JSON in C#)

~ Saschahi ~

Recommended Posts

Hello, I'm now trying for 3-4 days now to get the steamrep info out of the userinfo API.

But I can't get it to work. my Code:


            //I just took the example for this one, because the error is the same.

            var steamid = "76561198012598620";
            var json = new WebClient().DownloadString("https://backpack.tf/api/users/info/v1?steamids=76561198012598620&key=mah_key");
            dynamic jsontest = JsonConvert.DeserializeObject(json);
            string test = "Fehler";
            string test2 = "Fehler";
            string test3 = "Fehler";

                test = jsontest.users.steamid.name;
                test2 = jsontest.users[0].name;
                test3 = jsontest.users._76561198012598620.name;
            catch { }



test and test3 have nullpointerexceptions. test2 some error because it's not an array

to simplify it I just let it look up the name.

I can't get it past "users". and because users isn't an array or list, test2 doesn't give me anything too. Yes, i tried the long version too (with a class for each object), but 1. because it has no arrays whatsoever, I can't get it to work too.


anyone experienced the same problem?

For those who say I should use node.js, no. I won't.


sincerely, a highly stressed


Link to comment
Share on other sites

I never had any C# experience but I found csharppad.com and did some testing.


It looks like you're supposed to do this:

test = jsontest.users[steamid].name;


Link to comment
Share on other sites

On 14.5.2018 at 7:35 PM, Daddy Alex said:


test = jsontest.users[steamid].name;


God damn I love you. It took me 4 Days and i couldn't figure it out.

Take all my Likes. ALL OF THEM

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...