ServantSoftware.Data.Json 1.0.0.276

There is a newer version of this package available.
See the version list below for details.
dotnet add package ServantSoftware.Data.Json --version 1.0.0.276                
NuGet\Install-Package ServantSoftware.Data.Json -Version 1.0.0.276                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ServantSoftware.Data.Json" Version="1.0.0.276" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ServantSoftware.Data.Json --version 1.0.0.276                
#r "nuget: ServantSoftware.Data.Json, 1.0.0.276"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install ServantSoftware.Data.Json as a Cake Addin
#addin nuget:?package=ServantSoftware.Data.Json&version=1.0.0.276

// Install ServantSoftware.Data.Json as a Cake Tool
#tool nuget:?package=ServantSoftware.Data.Json&version=1.0.0.276                

JSON ADO.NET Data Provider

Package Name Release (NuGet)
ServantSoftware.Data.Json NuGet

The JSON ADO.NET Data Provider offers a set of classes that facilitate data access to JSON files using the ADO.NET framework. It provides CRUD (Create, Read, Update, Delete) operations to interact with JSON files as if they were a database.

Features

  • ADO.NET compliant provider for JSON files.
  • Support for CRUD operations.
  • Implementation of ADO.NET interfaces for consistency with other data providers.
  • Customizable and extendable to meet specific needs.
  • Comprehensive XML comments to assist with usage.

Getting Started

Prerequisites

  • .NET 7.0 or later.
  • An IDE that supports .NET development, such as Visual Studio.

Installation

You can install the JSON ADO.NET Data Provider from the NuGet package manager or by using the following command in your terminal:

dotnet add package ServantSoftware.Data.Json

Usage

To use the JSON ADO.NET Data Provider, you will need to create a JsonConnection instance, then create a JsonCommand instance, and execute it. Here's an example:

using System.Data.JsonClient;

var connectionString = new FileConnectionString() { DataSource = "path/to/your/file.json" };
using var connection = new JsonConnection(connectionString);
connection.Open();

var commandText = "SELECT * FROM your_table";
using var command = new JsonCommand(commandText, connection);
using var reader = command.ExecuteReader();

while (reader.Read())
{
    // Process data
}

connection.Close();

Connection String

The connection string is used mainly to determine the data source for the provider. The data source can be either a file path to a folder or a JSON file.

Folder As Database

If a path to a folder, then the folder represents the JSON database, and each JSON file in the folder represents a table. The file name then becomes the table's name, and you can expect the data within the file to be a JSON array of objects.

For example:

[  
    { "name": "Joe", "email": "Joe@gmail.com", "salary": 56000, "married": true },  
    { "name": "Bob", "email": "bob32@gmail.com", "salary": 95000 },  
]

In the above example, this table would have 4 columns, one for each unique name/value pair. Note: It is valid that there is not a name/value pair, as is seen for the "married" property in the second object. Internally, this object will be represented as having a "married" property of null.

File As Database

If a path to a JSON file, then the JSON file represents a database. In that case, you can expect the format of the file to be an object containing name/value pairs. Each name/value pair represents a table, and the value of that pair will be a JSON array of objects.

{
  "employees": 
  [  
    { "name": "Joe", "email": "Joe@gmail.com", "salary": 56000, "married": true },  
    { "name": "Bob", "email": "bob32@gmail.com", "salary": 95000 },  
  ],
  "locations":
  [
    { "city": "Houston", "state": "Texas", "zip": 77846 },
    { "city": "New Braunfels", "state": "Texas", "zip": 78132 },
  ]
}

The above example would represent a database containing 2 tables. The first table would be named "employees" containing 4 columns. The second table would be named "locations" and contain 3 columns.

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests.

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

Acknowledgments

  • Thanks to the .NET Foundation for the ADO.NET framework.
  • Thanks to everyone who has contributed to this project.
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on ServantSoftware.Data.Json:

Package Downloads
ServantSoftware.EFCore.Json

Package Description

ServantSoftware.SettingsOnADO.Json

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0.298 71 1/8/2025
1.0.0.297 94 1/7/2025
1.0.0.296 145 12/18/2024
1.0.0.295 99 12/18/2024
1.0.0.294 164 12/18/2024
1.0.0.293 139 12/18/2024
1.0.0.289 102 12/17/2024
1.0.0.288 122 12/16/2024
1.0.0.287 138 12/16/2024
1.0.0.286 167 12/14/2024
1.0.0.285 94 12/14/2024
1.0.0.284 103 12/11/2024
1.0.0.283 96 12/11/2024
1.0.0.282 92 12/10/2024
1.0.0.281 88 12/10/2024
1.0.0.280 94 12/10/2024
1.0.0.279 111 11/18/2024
1.0.0.278 102 11/15/2024
1.0.0.277 101 11/15/2024
1.0.0.276 110 11/15/2024
1.0.0.275 107 11/13/2024
1.0.0.274 106 11/13/2024
1.0.0.273 106 11/12/2024
1.0.0.272 117 11/11/2024
1.0.0.271 106 11/5/2024
1.0.0.270 110 11/5/2024
1.0.0.269 101 11/5/2024
1.0.0.268 108 11/1/2024
1.0.0.267 102 11/1/2024
1.0.0.266 106 11/1/2024
1.0.0.265 111 11/1/2024
1.0.0.264 111 11/1/2024
1.0.0.263 109 10/6/2024
1.0.0.262 98 10/6/2024
1.0.0.261 106 10/2/2024
1.0.0.260 107 10/2/2024
1.0.0.259 235 6/8/2024
1.0.0.258 501 4/17/2024
1.0.0.257 131 4/17/2024
1.0.0.256 131 4/17/2024
1.0.0.254 128 4/15/2024
1.0.0.253 121 4/15/2024
1.0.0.252 128 4/14/2024
1.0.0.251 119 4/14/2024
1.0.0.250 117 4/13/2024
1.0.0.249 120 4/13/2024
1.0.0.248 119 4/11/2024
1.0.0.247 120 4/11/2024
1.0.0.246 130 4/1/2024
1.0.0.245 130 4/1/2024
1.0.0.242 146 3/27/2024
1.0.0.241 127 3/27/2024
1.0.0.240 154 3/27/2024
1.0.0.239 113 3/27/2024
1.0.0.238 189 3/16/2024
1.0.0.237 131 3/16/2024
1.0.0.236 155 2/14/2024
1.0.0.235 185 12/20/2023
1.0.0.233 296 10/23/2023
1.0.0.232 142 10/23/2023
1.0.0.231 129 10/23/2023
1.0.0.230 125 10/23/2023
1.0.0.229 123 10/23/2023
1.0.0.228 136 10/22/2023
1.0.0.227 125 10/22/2023
1.0.0.226 142 10/22/2023
1.0.0.225 118 10/22/2023
1.0.0.224 130 10/22/2023
1.0.0.223 135 10/22/2023
1.0.0.222 147 10/22/2023
1.0.0.221 133 10/22/2023
1.0.0.220 131 10/21/2023
1.0.0.219 154 10/21/2023
1.0.0.218 136 10/21/2023
1.0.0.217 135 10/21/2023
1.0.0.216 147 10/21/2023
1.0.0.215 139 10/21/2023
1.0.0.214 138 10/21/2023
1.0.0.213 127 10/21/2023
1.0.0.212 125 10/21/2023
1.0.0.211 128 10/20/2023
1.0.0.210 130 10/20/2023
1.0.0.209 147 10/20/2023
1.0.0.208 143 10/20/2023
1.0.0.207 142 10/20/2023
1.0.0.206 154 10/20/2023
1.0.0.205 139 10/20/2023
1.0.0.204 126 10/19/2023
1.0.0.203 131 10/17/2023
1.0.0.202 331 10/10/2023
1.0.0.201 184 10/7/2023
1.0.0.200 146 10/3/2023
1.0.0.199 152 10/2/2023
1.0.0.198 137 10/2/2023
1.0.0.195 172 9/27/2023
1.0.0.194 146 9/27/2023
1.0.0.193 141 9/27/2023
1.0.0.192 129 9/27/2023
1.0.0.191 160 9/26/2023
1.0.0.189 226 9/22/2023
1.0.0.188 144 9/22/2023
1.0.0.187 141 9/22/2023
1.0.0.186 137 9/19/2023
1.0.0.185 276 9/18/2023
1.0.0.184 134 9/17/2023
1.0.0.183 137 9/17/2023
1.0.0.182 125 9/16/2023
1.0.0.181 147 9/15/2023
1.0.0.179 175 9/14/2023
1.0.0.178 162 9/14/2023
1.0.0.176 152 9/13/2023
1.0.0.175 147 9/9/2023
1.0.0.174 168 9/8/2023
1.0.0.173 154 9/1/2023
1.0.0.172 166 9/1/2023
1.0.0.171 161 8/31/2023
1.0.0.170 177 8/25/2023
1.0.0.169 156 8/24/2023