Scott Nimrod
Scott Nimrod

Reputation: 11595

Why is my JsonProvider causing an exception when parsing a file?

Can someone please explain what I am doing wrong?

I receive the following exception message when using a JsonProvider:

System.Exception: Invalid JSON starting at character 0, snippet =


https://fac


json =


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


My code is the following:

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"

The exception is thrown when executing this line:

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

NOTE:

I am referencing the this documentation.

Upvotes: 0

Views: 353

Answers (1)

Mark Seemann
Mark Seemann

Reputation: 233150

You're trying to parse a URL as JSON. You probably want MovieProvider.Load.

Upvotes: 2

Related Questions