I am trying to create my first UWP C# app. When the button named 'Button' is clicked, JSON shows up within the text box named 'TextBox'.
I am trying to work out how I can access only one part of the JSON text (data.best_day.text) for example (in JavaScript) data.best_day.text would give 18 hrs 3 mins. I would like to do the same for this UWP app. I have read some resources but they didn't work or were way too complex to understand. Any help would be greatly appreciated. :)
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409
namespace WakaTime
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class MainPage : Page
{
public MainPage()
{
this.InitializeComponent();
}
private async void Button_Click(object sender, RoutedEventArgs e)
{
var client = new HttpClient();
var text = await client.GetStringAsync("https://wakatime.com/share/@DontBugMie/bef7afe4-102d-47a9-9678-6335510ebedd.json");
TextBox.Text = text;
}
}
}