为什么我的JsonProvider在解析文件时会导致异常?

时间:2016-11-02 12:52:38

标签: f# type-providers

有人可以解释一下我做错了吗?

使用JsonProvider时收到以下异常消息:

  
    

System.Exception:从字符0开始的无效JSON,snippet =

  
           

https://fac

           

json =

           

https://facebook.github.io/react-native/movies.json

     

我的代码如下:

open FSharp.Data

type MovieProvider = JsonProvider<"https://facebook.github.io/react-native/movies.json">

let result = MovieProvider.Parse "https://facebook.github.io/react-native/movies.json"

执行此行时抛出异常:

let result = MovieProvider.Parse "https://facebook.github.io/react-native/movies.json"

注:

我引用了这个documentation

1 个答案:

答案 0 :(得分:1)

您正在尝试将URL解析为JSON。您可能需要MovieProvider.Load