I write an API using springMVC.It's a simple API, I just use it to test JsonProvider.
@ResponseBody
@RequestMapping(value = "/api/test", method = RequestMethod.GET)
public TestClass test(final HttpServletRequest request,
final HttpServletResponse response){
return new TestClass("cc");
}
class TestClass{
public TestClass(){
}
public TestClass(final String name) {
super();
this.name = name;
}
private String name;
public String getName() {
return name;
}
public void setName(final String name) {
this.name = name;
}
}
The API simply returns 
But JsonProvider just throws a compile error.
Severity Code Description Project File Line
Error The type provider 'ProviderImplementation.JsonProvider' reported an error: Cannot read sample JSON from 'http://localhost/api/test': Invalid JSON starting at character 0, snippet =
----
"{\"name\":
-----
json =
------
"{\"name\":\"cc\"}"
------- JsonProcess c:\users\xx\documents\visual studio 2015\Projects\JsonProcess\JsonProcess\Program.fs 8
The F# code:
open FSharp.Data
[<Literal>]
let jsonValue = """
{"name":"cc"}
"""
type JsonData = JsonProvider<"http://localhost/api/test">
[<EntryPoint>]
let main argv =
0 // return an integer exit code
Use the String literal jsonValue as sample is ok.type JsonData = JsonProvider<jsonValue>
CultureandEncodingparameters of theJsonProvidertype? I would also opening your JSON file from Notepad++ or a similar tool, with hidden characters enabled, and comparing it to a known working JSON (e.g. api.worldbank.org/country/cz/indicator/…)Encoding = "UTF-8"but still no help.Maybe I should tryCulturelater.But as you can see the chrome plugin works fine.It formats the JSON correctly and java json lib likesjacksonalso works.I try to use other APIs like worldbank and taobao, they are ok.It's strange.jacksonfor java,JSON.NETfor .NET,chrome json plugin and so on)