|
@@ -78,20 +78,21 @@ look for the ``name`` field and print that to console.
|
|
|
.. code-tab:: csharp
|
|
|
|
|
|
using Godot;
|
|
|
+ using System.Text;
|
|
|
|
|
|
public partial class MyNode : Node
|
|
|
{
|
|
|
public override void _Ready()
|
|
|
{
|
|
|
- GetNode("HTTPRequest").RequestCompleted += OnRequestCompleted;
|
|
|
HttpRequest httpRequest = GetNode<HttpRequest>("HTTPRequest");
|
|
|
+ httpRequest.RequestCompleted += OnRequestCompleted;
|
|
|
httpRequest.Request("https://api.github.com/repos/godotengine/godot/releases/latest");
|
|
|
}
|
|
|
|
|
|
private void OnRequestCompleted(long result, long responseCode, string[] headers, byte[] body)
|
|
|
{
|
|
|
- JsonParseResult json = Json.Parse(Encoding.UTF8.GetString(body));
|
|
|
- GD.Print(json.Result);
|
|
|
+ Godot.Collections.Dictionary json = Json.ParseString(Encoding.UTF8.GetString(body)).AsGodotDictionary();
|
|
|
+ GD.Print(json["name"]);
|
|
|
}
|
|
|
}
|
|
|
|