Usage Example
using System.Collections.Generic;
using Sandbox;
public struct Post {
// Two important things to note:
// 1. The property names aren't case-sensitive, so they can be capitalized differently in the code.
// 2. The { get; set; } is necessary for the JSON deserializer to work properly.
public int UserId { get; set; }
public int Id { get; set; }
public string Title { get; set; }
public string Body { get; set; }
}
public class RequestJsonAsyncExample {
// This is a console command that can be executed in the console to run the example.
[ConCmd("requestjson_example")]
public async static void ConCmdRequestJsonExample() {
var posts = await Http.RequestJsonAsync<List<Post>>( "https://jsonplaceholder.typicode.com/posts" );
Log.Info(posts);
}
}