https://github.com/fable-compiler/fable.jsonprovider
F# JSON Type Provider for Fable
https://github.com/fable-compiler/fable.jsonprovider
Last synced: 6 months ago
JSON representation
F# JSON Type Provider for Fable
- Host: GitHub
- URL: https://github.com/fable-compiler/fable.jsonprovider
- Owner: fable-compiler
- License: mit
- Created: 2019-02-25T02:14:20.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2024-04-03T18:48:05.000Z (about 1 year ago)
- Last Synced: 2024-04-14T12:57:29.877Z (about 1 year ago)
- Language: F#
- Size: 683 KB
- Stars: 28
- Watchers: 7
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Fable.JsonProvider
Simple F# JSON Type Provider compatible with Fable. Currently tested with Fable 3 RC 11.
## Testing
```shell
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**.
```fsharp
type MyJson = Fable.JsonProvider.Generator<"""{
"foo": 5,
"bar": ["baz"]
}""">let json = MyJson("""{"foo": 10, "bar": [] }""")
printfn "%.0f" json.foo // prints 10
```