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.
<PackageVersion Include="ServantSoftware.Data.Json" Version="1.0.0.276" />
                    
Directory.Packages.props
<PackageReference Include="ServantSoftware.Data.Json" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version 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.
#addin nuget:?package=ServantSoftware.Data.Json&version=1.0.0.276
                    
Install as a Cake Addin
#tool nuget:?package=ServantSoftware.Data.Json&version=1.0.0.276
                    
Install as a Cake Tool

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.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.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.354 200 4/16/2025
1.0.0.353 167 4/6/2025
1.0.0.352 144 4/6/2025
1.0.0.351 143 4/6/2025
1.0.0.350 119 4/6/2025
1.0.0.349 478 3/26/2025
1.0.0.348 458 3/26/2025
1.0.0.347 298 3/26/2025
1.0.0.346 463 3/26/2025
1.0.0.345 473 3/25/2025
1.0.0.344 477 3/25/2025
1.0.0.343 98 3/21/2025
1.0.0.342 108 3/21/2025
1.0.0.341 112 3/21/2025
1.0.0.340 106 3/21/2025
1.0.0.339 147 3/21/2025
1.0.0.338 151 3/20/2025
1.0.0.336 148 3/19/2025
1.0.0.335 145 3/19/2025
1.0.0.332 147 3/18/2025
1.0.0.331 146 3/18/2025
1.0.0.330 144 3/18/2025
1.0.0.329 140 3/18/2025
1.0.0.328 141 3/18/2025
1.0.0.327 143 3/18/2025
1.0.0.326 143 3/18/2025
1.0.0.325 142 3/18/2025
1.0.0.324 143 3/18/2025
1.0.0.322 149 3/18/2025
1.0.0.319 148 3/17/2025
1.0.0.318 144 3/17/2025
1.0.0.317 136 3/16/2025
1.0.0.316 77 3/15/2025
1.0.0.315 80 3/14/2025
1.0.0.314 104 3/14/2025
1.0.0.313 98 3/14/2025
1.0.0.312 148 3/13/2025
1.0.0.311 146 3/13/2025
1.0.0.308 149 3/13/2025
1.0.0.307 140 3/13/2025
1.0.0.305 163 3/12/2025
1.0.0.302 183 3/9/2025
1.0.0.301 160 3/8/2025
1.0.0.298 212 1/8/2025
1.0.0.297 145 1/7/2025
1.0.0.296 159 12/18/2024
1.0.0.295 115 12/18/2024
1.0.0.294 174 12/18/2024
1.0.0.293 152 12/18/2024
1.0.0.289 118 12/17/2024
1.0.0.288 136 12/16/2024
1.0.0.287 155 12/16/2024
1.0.0.286 190 12/14/2024
1.0.0.285 110 12/14/2024
1.0.0.284 119 12/11/2024
1.0.0.283 111 12/11/2024
1.0.0.282 106 12/10/2024
1.0.0.281 100 12/10/2024
1.0.0.280 106 12/10/2024
1.0.0.279 120 11/18/2024
1.0.0.278 115 11/15/2024
1.0.0.277 110 11/15/2024
1.0.0.276 122 11/15/2024
1.0.0.275 115 11/13/2024
1.0.0.274 116 11/13/2024
1.0.0.273 114 11/12/2024
1.0.0.272 127 11/11/2024
1.0.0.271 113 11/5/2024
1.0.0.270 116 11/5/2024
1.0.0.269 112 11/5/2024
1.0.0.268 117 11/1/2024
1.0.0.267 113 11/1/2024
1.0.0.266 116 11/1/2024
1.0.0.265 123 11/1/2024
1.0.0.264 122 11/1/2024
1.0.0.263 118 10/6/2024
1.0.0.262 106 10/6/2024
1.0.0.261 119 10/2/2024
1.0.0.260 118 10/2/2024
1.0.0.259 243 6/8/2024
1.0.0.258 509 4/17/2024
1.0.0.257 139 4/17/2024
1.0.0.256 141 4/17/2024
1.0.0.254 136 4/15/2024
1.0.0.253 128 4/15/2024
1.0.0.252 136 4/14/2024
1.0.0.251 126 4/14/2024
1.0.0.250 123 4/13/2024
1.0.0.249 128 4/13/2024
1.0.0.248 130 4/11/2024
1.0.0.247 130 4/11/2024
1.0.0.246 138 4/1/2024
1.0.0.245 136 4/1/2024
1.0.0.242 157 3/27/2024
1.0.0.241 138 3/27/2024
1.0.0.240 164 3/27/2024
1.0.0.239 120 3/27/2024
1.0.0.238 198 3/16/2024
1.0.0.237 142 3/16/2024
1.0.0.236 165 2/14/2024
1.0.0.235 195 12/20/2023
1.0.0.233 307 10/23/2023
1.0.0.232 149 10/23/2023
1.0.0.231 140 10/23/2023
1.0.0.230 136 10/23/2023
1.0.0.229 135 10/23/2023
1.0.0.228 146 10/22/2023
1.0.0.227 136 10/22/2023
1.0.0.226 149 10/22/2023
1.0.0.225 124 10/22/2023
1.0.0.224 136 10/22/2023
1.0.0.223 146 10/22/2023
1.0.0.222 155 10/22/2023
1.0.0.221 143 10/22/2023
1.0.0.220 141 10/21/2023
1.0.0.219 161 10/21/2023
1.0.0.218 143 10/21/2023
1.0.0.217 146 10/21/2023
1.0.0.216 156 10/21/2023
1.0.0.215 145 10/21/2023
1.0.0.214 147 10/21/2023
1.0.0.213 136 10/21/2023
1.0.0.212 133 10/21/2023
1.0.0.211 136 10/20/2023
1.0.0.210 138 10/20/2023
1.0.0.209 159 10/20/2023
1.0.0.208 152 10/20/2023
1.0.0.207 148 10/20/2023
1.0.0.206 162 10/20/2023
1.0.0.205 147 10/20/2023
1.0.0.204 138 10/19/2023
1.0.0.203 137 10/17/2023
1.0.0.202 343 10/10/2023
1.0.0.201 190 10/7/2023
1.0.0.200 155 10/3/2023
1.0.0.199 160 10/2/2023
1.0.0.198 147 10/2/2023
1.0.0.195 180 9/27/2023
1.0.0.194 156 9/27/2023
1.0.0.193 155 9/27/2023
1.0.0.192 139 9/27/2023
1.0.0.191 168 9/26/2023
1.0.0.189 233 9/22/2023
1.0.0.188 155 9/22/2023
1.0.0.187 148 9/22/2023
1.0.0.186 146 9/19/2023
1.0.0.185 284 9/18/2023
1.0.0.184 144 9/17/2023
1.0.0.183 148 9/17/2023
1.0.0.182 133 9/16/2023
1.0.0.181 155 9/15/2023
1.0.0.179 182 9/14/2023
1.0.0.178 173 9/14/2023
1.0.0.176 160 9/13/2023
1.0.0.175 161 9/9/2023
1.0.0.174 178 9/8/2023
1.0.0.173 165 9/1/2023
1.0.0.172 177 9/1/2023
1.0.0.171 170 8/31/2023
1.0.0.170 190 8/25/2023
1.0.0.169 169 8/24/2023