ServantSoftware.Data.Json 1.0.0.218

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.218
                    
NuGet\Install-Package ServantSoftware.Data.Json -Version 1.0.0.218
                    
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.218" />
                    
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.218" />
                    
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.218
                    
#r "nuget: ServantSoftware.Data.Json, 1.0.0.218"
                    
#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.218
                    
Install as a Cake Addin
#tool nuget:?package=ServantSoftware.Data.Json&version=1.0.0.218
                    
Install as a Cake Tool

JSON ADO.NET Data Provider

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 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. 
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 203 4/16/2025
1.0.0.353 168 4/6/2025
1.0.0.352 146 4/6/2025
1.0.0.351 144 4/6/2025
1.0.0.350 120 4/6/2025
1.0.0.349 480 3/26/2025
1.0.0.348 459 3/26/2025
1.0.0.347 299 3/26/2025
1.0.0.346 464 3/26/2025
1.0.0.345 474 3/25/2025
1.0.0.344 478 3/25/2025
1.0.0.343 99 3/21/2025
1.0.0.342 108 3/21/2025
1.0.0.341 112 3/21/2025
1.0.0.340 107 3/21/2025
1.0.0.339 148 3/21/2025
1.0.0.338 152 3/20/2025
1.0.0.336 149 3/19/2025
1.0.0.335 146 3/19/2025
1.0.0.332 148 3/18/2025
1.0.0.331 146 3/18/2025
1.0.0.330 144 3/18/2025
1.0.0.329 141 3/18/2025
1.0.0.328 142 3/18/2025
1.0.0.327 143 3/18/2025
1.0.0.326 144 3/18/2025
1.0.0.325 143 3/18/2025
1.0.0.324 144 3/18/2025
1.0.0.322 150 3/18/2025
1.0.0.319 149 3/17/2025
1.0.0.318 145 3/17/2025
1.0.0.317 137 3/16/2025
1.0.0.316 78 3/15/2025
1.0.0.315 81 3/14/2025
1.0.0.314 105 3/14/2025
1.0.0.313 99 3/14/2025
1.0.0.312 149 3/13/2025
1.0.0.311 147 3/13/2025
1.0.0.308 150 3/13/2025
1.0.0.307 141 3/13/2025
1.0.0.305 164 3/12/2025
1.0.0.302 184 3/9/2025
1.0.0.301 162 3/8/2025
1.0.0.298 213 1/8/2025
1.0.0.297 145 1/7/2025
1.0.0.296 160 12/18/2024
1.0.0.295 116 12/18/2024
1.0.0.294 175 12/18/2024
1.0.0.293 153 12/18/2024
1.0.0.289 119 12/17/2024
1.0.0.288 136 12/16/2024
1.0.0.287 156 12/16/2024
1.0.0.286 191 12/14/2024
1.0.0.285 110 12/14/2024
1.0.0.284 120 12/11/2024
1.0.0.283 111 12/11/2024
1.0.0.282 107 12/10/2024
1.0.0.281 101 12/10/2024
1.0.0.280 107 12/10/2024
1.0.0.279 121 11/18/2024
1.0.0.278 115 11/15/2024
1.0.0.277 111 11/15/2024
1.0.0.276 122 11/15/2024
1.0.0.275 116 11/13/2024
1.0.0.274 117 11/13/2024
1.0.0.273 115 11/12/2024
1.0.0.272 127 11/11/2024
1.0.0.271 113 11/5/2024
1.0.0.270 117 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 124 11/1/2024
1.0.0.264 123 11/1/2024
1.0.0.263 118 10/6/2024
1.0.0.262 107 10/6/2024
1.0.0.261 120 10/2/2024
1.0.0.260 118 10/2/2024
1.0.0.259 244 6/8/2024
1.0.0.258 510 4/17/2024
1.0.0.257 140 4/17/2024
1.0.0.256 141 4/17/2024
1.0.0.254 136 4/15/2024
1.0.0.253 129 4/15/2024
1.0.0.252 137 4/14/2024
1.0.0.251 127 4/14/2024
1.0.0.250 124 4/13/2024
1.0.0.249 129 4/13/2024
1.0.0.248 131 4/11/2024
1.0.0.247 131 4/11/2024
1.0.0.246 139 4/1/2024
1.0.0.245 137 4/1/2024
1.0.0.242 158 3/27/2024
1.0.0.241 139 3/27/2024
1.0.0.240 165 3/27/2024
1.0.0.239 121 3/27/2024
1.0.0.238 199 3/16/2024
1.0.0.237 143 3/16/2024
1.0.0.236 166 2/14/2024
1.0.0.235 195 12/20/2023
1.0.0.233 310 10/23/2023
1.0.0.232 152 10/23/2023
1.0.0.231 143 10/23/2023
1.0.0.230 139 10/23/2023
1.0.0.229 138 10/23/2023
1.0.0.228 149 10/22/2023
1.0.0.227 139 10/22/2023
1.0.0.226 152 10/22/2023
1.0.0.225 127 10/22/2023
1.0.0.224 139 10/22/2023
1.0.0.223 149 10/22/2023
1.0.0.222 158 10/22/2023
1.0.0.221 146 10/22/2023
1.0.0.220 144 10/21/2023
1.0.0.219 164 10/21/2023
1.0.0.218 146 10/21/2023
1.0.0.217 149 10/21/2023
1.0.0.216 159 10/21/2023
1.0.0.215 148 10/21/2023
1.0.0.214 150 10/21/2023
1.0.0.213 139 10/21/2023
1.0.0.212 136 10/21/2023
1.0.0.211 139 10/20/2023
1.0.0.210 141 10/20/2023
1.0.0.209 162 10/20/2023
1.0.0.208 155 10/20/2023
1.0.0.207 151 10/20/2023
1.0.0.206 166 10/20/2023
1.0.0.205 151 10/20/2023
1.0.0.204 142 10/19/2023
1.0.0.203 141 10/17/2023
1.0.0.202 348 10/10/2023
1.0.0.201 194 10/7/2023
1.0.0.200 159 10/3/2023
1.0.0.199 164 10/2/2023
1.0.0.198 151 10/2/2023
1.0.0.195 184 9/27/2023
1.0.0.194 160 9/27/2023
1.0.0.193 159 9/27/2023
1.0.0.192 143 9/27/2023
1.0.0.191 172 9/26/2023
1.0.0.189 237 9/22/2023
1.0.0.188 159 9/22/2023
1.0.0.187 152 9/22/2023
1.0.0.186 150 9/19/2023
1.0.0.185 288 9/18/2023
1.0.0.184 148 9/17/2023
1.0.0.183 152 9/17/2023
1.0.0.182 137 9/16/2023
1.0.0.181 159 9/15/2023
1.0.0.179 186 9/14/2023
1.0.0.178 177 9/14/2023
1.0.0.176 164 9/13/2023
1.0.0.175 165 9/9/2023
1.0.0.174 182 9/8/2023
1.0.0.173 169 9/1/2023
1.0.0.172 181 9/1/2023
1.0.0.171 174 8/31/2023
1.0.0.170 194 8/25/2023
1.0.0.169 173 8/24/2023