~ Saschahi ~ Posted May 14, 2018 Share Posted May 14, 2018 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"; try { test = jsontest.users.steamid.name; test2 = jsontest.users[0].name; test3 = jsontest.users._76561198012598620.name; } catch { } Console.WriteLine(test); Console.WriteLine(test2); Console.WriteLine(test3); Console.ReadKey(); 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 Saschahi. Link to comment Share on other sites More sharing options...
D.Alex Posted May 14, 2018 Share Posted May 14, 2018 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 More sharing options...
~ Saschahi ~ Posted May 15, 2018 Author Share Posted May 15, 2018 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.