All Projects → fable-compiler → Fable.JsonProvider

fable-compiler / Fable.JsonProvider

Licence: MIT License
F# JSON Type Provider for Fable

Programming Languages

F#
602 projects

Fable.JsonProvider

Simple F# JSON Type Provider compatible with Fable. Currently tested with Fable 3 RC 11.

Testing

dotnet fsi build.fsx start

Usage

  • First, install the package Fable.JsonProvider from Nuget.
  • Then generate your model using a JSON url, file path or literal string. You can construct instances with other strings at runtime and the compiler will make sure you only access properties according to the original sample.

Please note there're currently no runtime checks to validate the JSON.

type MyJson = Fable.JsonProvider.Generator<"""{
  "foo": 5,
  "bar": ["baz"]
}""">

let json = MyJson("""{"foo": 10, "bar": [] }""")
printfn "%.0f" json.foo // prints 10
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].