Question

I'm trying to compile simple example:

open Microsoft.FSharp.Data

type Simple = JsonProvider<""" { "name":"John", "age":94 } """>
let simple = Simple.Parse(""" { "name":"Tomas", "age":4 } """)
simple.Age
simple.Name

I use MSVS 2010, .Net Framework 4.5.1 and FSharp.Data via nuget. But when I try to compile this example, I get error:

This token (<""", """>, (""") and """)) is reserved for future use.

How can I use F# Json Type Provider?

Était-ce utile?

La solution

Type providers are part of F# 3.0. Are you sure, you are using the F# 3.0 or F# 3.1 compiler? I thought Visual Studio 2010 came with F# 2.0.

I remember, that the """ strings were also added in F# 3.0

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top