ServantSoftware.Data.Json
1.0.0.186
See the version list below for details.
dotnet add package ServantSoftware.Data.Json --version 1.0.0.186
NuGet\Install-Package ServantSoftware.Data.Json -Version 1.0.0.186
<PackageReference Include="ServantSoftware.Data.Json" Version="1.0.0.186" />
paket add ServantSoftware.Data.Json --version 1.0.0.186
#r "nuget: ServantSoftware.Data.Json, 1.0.0.186"
// Install ServantSoftware.Data.Json as a Cake Addin #addin nuget:?package=ServantSoftware.Data.Json&version=1.0.0.186 // Install ServantSoftware.Data.Json as a Cake Tool #tool nuget:?package=ServantSoftware.Data.Json&version=1.0.0.186
JSON Data Provider
- Only use classes from the System.Text.Json namespace to serialize/deserialize JSON. No dependencies on Newtonsoft allowed.
- Using non-Microsoft libraries requires approval. Minimal dependencies is ideal and if we want/need to bring in other dependencies, those dependencies need to be platform agnostic, royality-free and lean toward unrestrictive licensing such as a MIT license.
- 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 to a json file.
- 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 that data within the file 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: If 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.
- If a path to a json file, then the json file represents a database. In that case then, 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 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.
For determination of the data type of a property of a model, limit the valid data types to string, number (System.Int64 or System.Double depending on the data provided), and boolean (See JSON Data Types) or an IEnumerable<> of any of those data types. Values of type Int64, double and bool, you must determine if any of the properties in the array of objects contains a null value. If so, then the property within the model must be nullable.
- For determining data type in this flattened structure, if the value of a name/value pair is a JSON object, then assume a data type of string and the value of that column is just the JSON string of the object. A future task (but is not part of the bid on this task) may be to extend this data provider to determine tables based on nested objects within the JSON data structure.
Internally for the JsonCommand class, parsing of the IDbCommand.CommandText property should use the Irony library with the SQL Grammar that they have provided.
- If I were implementing this project, I'd probably load the JSON files into a System.Data.DataSet and use Dynamic Linq and LINQ to DataSet so that it could handle the parsing and syntax trees in the WHERE clause predicates, etc... (instead of doing it in my own code, which I would later have to maintain).
JSON comments is to have some support in this data provider. When the Caption property of a DataColumn is set in a DataSet and then the JsonDataAdapter's Update() method is called, that Caption property, if it has been set, (Note: According to the docs, its value will be the name of the Column if it hasn't been set. So ignore that case where Caption == Name.) it will be written within the JSON stored to disk. For example:
{
"key": "value" // comment for this key here.
}
System.Text.Json has some support for this JsonCommentHandling Enum & JsonTokenType.Comment Enum, but no research has been done to determine if it supports writting these comments to disk. When reading the JSON from disk, if multiple rows of a table for a particular column have a comment, it is okay to use just the first occurence of a comment if/when setting the DataColumn's Caption property.
Product | Versions 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. |
-
net7.0
- ServantSoftware.Data.Common (>= 1.0.0.186)
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.268 | 33 | 11/1/2024 |
1.0.0.267 | 29 | 11/1/2024 |
1.0.0.266 | 33 | 11/1/2024 |
1.0.0.265 | 33 | 11/1/2024 |
1.0.0.264 | 30 | 11/1/2024 |
1.0.0.263 | 91 | 10/6/2024 |
1.0.0.262 | 80 | 10/6/2024 |
1.0.0.261 | 86 | 10/2/2024 |
1.0.0.260 | 91 | 10/2/2024 |
1.0.0.259 | 215 | 6/8/2024 |
1.0.0.258 | 488 | 4/17/2024 |
1.0.0.257 | 116 | 4/17/2024 |
1.0.0.256 | 121 | 4/17/2024 |
1.0.0.254 | 117 | 4/15/2024 |
1.0.0.253 | 107 | 4/15/2024 |
1.0.0.252 | 113 | 4/14/2024 |
1.0.0.251 | 105 | 4/14/2024 |
1.0.0.250 | 106 | 4/13/2024 |
1.0.0.249 | 108 | 4/13/2024 |
1.0.0.248 | 106 | 4/11/2024 |
1.0.0.247 | 105 | 4/11/2024 |
1.0.0.246 | 120 | 4/1/2024 |
1.0.0.245 | 119 | 4/1/2024 |
1.0.0.242 | 133 | 3/27/2024 |
1.0.0.241 | 116 | 3/27/2024 |
1.0.0.240 | 142 | 3/27/2024 |
1.0.0.239 | 101 | 3/27/2024 |
1.0.0.238 | 178 | 3/16/2024 |
1.0.0.237 | 118 | 3/16/2024 |
1.0.0.236 | 141 | 2/14/2024 |
1.0.0.235 | 175 | 12/20/2023 |
1.0.0.233 | 281 | 10/23/2023 |
1.0.0.232 | 130 | 10/23/2023 |
1.0.0.231 | 119 | 10/23/2023 |
1.0.0.230 | 115 | 10/23/2023 |
1.0.0.229 | 113 | 10/23/2023 |
1.0.0.228 | 126 | 10/22/2023 |
1.0.0.227 | 115 | 10/22/2023 |
1.0.0.226 | 132 | 10/22/2023 |
1.0.0.225 | 106 | 10/22/2023 |
1.0.0.224 | 118 | 10/22/2023 |
1.0.0.223 | 125 | 10/22/2023 |
1.0.0.222 | 137 | 10/22/2023 |
1.0.0.221 | 123 | 10/22/2023 |
1.0.0.220 | 119 | 10/21/2023 |
1.0.0.219 | 144 | 10/21/2023 |
1.0.0.218 | 126 | 10/21/2023 |
1.0.0.217 | 125 | 10/21/2023 |
1.0.0.216 | 137 | 10/21/2023 |
1.0.0.215 | 129 | 10/21/2023 |
1.0.0.214 | 128 | 10/21/2023 |
1.0.0.213 | 117 | 10/21/2023 |
1.0.0.212 | 115 | 10/21/2023 |
1.0.0.211 | 113 | 10/20/2023 |
1.0.0.210 | 119 | 10/20/2023 |
1.0.0.209 | 136 | 10/20/2023 |
1.0.0.208 | 130 | 10/20/2023 |
1.0.0.207 | 128 | 10/20/2023 |
1.0.0.206 | 142 | 10/20/2023 |
1.0.0.205 | 129 | 10/20/2023 |
1.0.0.204 | 116 | 10/19/2023 |
1.0.0.203 | 121 | 10/17/2023 |
1.0.0.202 | 317 | 10/10/2023 |
1.0.0.201 | 172 | 10/7/2023 |
1.0.0.200 | 133 | 10/3/2023 |
1.0.0.199 | 139 | 10/2/2023 |
1.0.0.198 | 124 | 10/2/2023 |
1.0.0.195 | 160 | 9/27/2023 |
1.0.0.194 | 134 | 9/27/2023 |
1.0.0.193 | 131 | 9/27/2023 |
1.0.0.192 | 119 | 9/27/2023 |
1.0.0.191 | 149 | 9/26/2023 |
1.0.0.189 | 213 | 9/22/2023 |
1.0.0.188 | 129 | 9/22/2023 |
1.0.0.187 | 128 | 9/22/2023 |
1.0.0.186 | 126 | 9/19/2023 |
1.0.0.185 | 260 | 9/18/2023 |
1.0.0.184 | 121 | 9/17/2023 |
1.0.0.183 | 125 | 9/17/2023 |
1.0.0.182 | 113 | 9/16/2023 |
1.0.0.181 | 131 | 9/15/2023 |
1.0.0.179 | 163 | 9/14/2023 |
1.0.0.178 | 150 | 9/14/2023 |
1.0.0.176 | 139 | 9/13/2023 |
1.0.0.175 | 135 | 9/9/2023 |
1.0.0.174 | 155 | 9/8/2023 |
1.0.0.173 | 138 | 9/1/2023 |
1.0.0.172 | 155 | 9/1/2023 |
1.0.0.171 | 150 | 8/31/2023 |
1.0.0.170 | 166 | 8/25/2023 |
1.0.0.169 | 145 | 8/24/2023 |