F# Data: Library for Data Access
The F# Data library implements everything you need to access data in your F# applications and scripts. It contains F# type providers for working with structured file formats (CSV, JSON and XML) and for accessing the WorldBank and Freebase services. It also includes helpers for parsing JSON and CSV files and for sending HTTP requests.
This library focuses on providing a simple, mostly read-only, access to the structured documents and other data sources. It does not aim to be a comprehensive collection of F# type providers (which can be used for numerous other purposes). It's also designed to play well with other libraries like Deedle, R Type Provider, F# Charting and FunScript.
F# Data type providers in action
How to get F# Data
The F# Data Library is available as FSharp.Data on NuGet. In addition to the official releases, you can also get NuGet packages from the Continuous Integration package source.
Alternatively, you can download the source as a ZIP file or download the compiled binaries as a ZIP.
Please note that on windows when downloading a zip file withdll
files the files will be blocked, and you have to manually unblock them in the file properties.
F# Data documentation and tutorials
F# type providers
The type providers for structured file formats infer the structure of a sample document (or a document containing multiple samples). The structure is then used to provide easy to use type-safe access to documents that follow the same structure. The library also implements a type provider for accessing data from the WorldBank and Freebase graph database.
- XML Type Provider - discusses the
XmlProvider<..>
type - JSON Type Provider - discusses the
JsonProvider<..>
type - CSV Type Provider - discusses the
CsvProvider<..>
type - WorldBank Provider - discusses the
WorldBankData
type and theWorldBankDataProvider<..>
type - Freebase Provider - discusses the
FreebaseData
type and theFreebaseDataProvider<..>
type
Data access tools
In addition to the F# type providers, the library also defines several types that simplify data access. In particular, it includes tools for HTTP web requests and a JSON and CSV parsers with simple dynamic API. For more information about these types, see the following topics:
- JSON Parser and Reader - introduces the JSON parser (without using the type provider)
- CSV Parser and Reader - introduces the CSV parser (without using the type provider)
- HTTP Utilities - discusses the
Http
type that can be used to send HTTP web requests.
Tutorials
The above articles cover all key features of the F# Data library. However, if you're interested in more samples or more details, then the following tutorials contain additional examples that use multiple different features together:
- Converting between JSON and XML - implements two serialization
functions that convert between the standard .NET
XElement
and theJsonValue
from F# Data. The tutorial demonstrates pattern matching onJsonValue
. - Anonymizing JSON - implements a function to anonymize a
JsonValue
from F# Data. The tutorial demonstrates pattern matching onJsonValue
.
Reference Documentation
There's also reference documentation available. Please note that everything under
the FSharp.Data.Runtime
namespace is not considered as part of the public API and can change without notice.
Contributing and license
The library is available under Apache 2.0. For more information see the License file in the GitHub repository. In summary, this means that you can use the library for commercial purposes, fork it, and modify it as you wish.
F# Data is made possible by the volunteer work of more than a dozen contributors and we're open to contributions from anyone. If you want to help out but don't know where to start, you can take one of the Up-For-Grabs issues, or help to improve the documentation.
The project is hosted on GitHub where you can report issues, fork the project and submit pull requests. If you're adding new public API's, please also contribute samples that can be turned into a documentation.
If you want to discuss an issue or feature that you want to add the to the library, then you can submit an issue or feature request via Github or you can send an email to the F# open source mailing list.
For more information about the library architecture, organization, how to debug, etc., see the contributing to F# data page.