I am trying to execute the following F # script code on my macbook prousing FSIin visual studio codeand plugin ionide.
#r "packages/Newtonsoft.Json.9.0.1/lib/net40/Newtonsoft.Json.dll"
#r "System.Net.Http"
open System
open System.Net.Http
open Newtonsoft.Json
let client = new HttpClient()
type AlbumInfo = { userId:int; id:int; title:string }
let url = "https://jsonplaceholder.typicode.com/albums/1"
async {
let! res = Async.AwaitTask <| client.GetAsync(url)
let! content = Async.AwaitTask <| res.Content.ReadAsStringAsync()
let x = JsonConvert.DeserializeObject<AlbumInfo>(content)
printfn "%s" x.title
} |> Async.Start
printfn "Please wait..."
But I get no output except Please wait.... However, when I put https://jsonplaceholder.typicode.com/albums/1in the browser, I get the expected response Json. Therefore, I know that there is no problem getting the API.
Also, when I run the same code in Visual Studio 2013on my PC Windows 10. The code gives the expected result. those. Please wait...and titlealbum.
Any ideas why this is not working correctly on mine macbook?