4

GitHub - WhiteBlackGoose/json2fs: Tool which converts json from file into F# rec...

 2 years ago
source link: https://github.com/WhiteBlackGoose/json2fs
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

json2fs

Tool which converts json from file into F# records. There's also library Json2Fs.Core. Both can be found on nuget.org.

Usage of Json2Fs

Get it from nuget:

dotnet tool install json2fs --global --prerelease

Run it like this:

json2fs WebsiteResponse your/path/to.json dst.fs

Where WebsiteResponse is the name of the root record (the one you will be deserializing into).

Usage of Json2Fs.Core

open Json2Fs.Core

let json = ... // string

let jsonElement = JsonSerializer.Deserialize<JsonElement> json

let dtos = generateFSharpDTOsByJson typename jsonElement // a list of records

let ``F# code`` = fsRecordsToString dtos // this converts it to the actual code

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK