JMI.Json.Data
0.10.2556
dotnet add package JMI.Json.Data --version 0.10.2556
NuGet\Install-Package JMI.Json.Data -Version 0.10.2556
<PackageReference Include="JMI.Json.Data" Version="0.10.2556" />
<PackageVersion Include="JMI.Json.Data" Version="0.10.2556" />
<PackageReference Include="JMI.Json.Data" />
paket add JMI.Json.Data --version 0.10.2556
#r "nuget: JMI.Json.Data, 0.10.2556"
#:package JMI.Json.Data@0.10.2556
#addin nuget:?package=JMI.Json.Data&version=0.10.2556
#tool nuget:?package=JMI.Json.Data&version=0.10.2556
Json Schema Data Generator
JSON Schema Data Generator is a .NET library that generates random JSON data based on a provided JSON schema. It leverages the Newtonsoft.Json.Schema library to parse and interpret the JSON schema, allowing for the creation of diverse and complex JSON structures that adhere to the defined schema.
Features
- Generates random JSON data based on a provided JSON schema.
- Supports various JSON schema features, including types, properties, arrays, and constraints.
- Easily integrates into .NET applications for testing, prototyping, and data generation purposes.
- Customizable data generation options to suit specific needs.
- Supports generation of coherent GPS data for moving vehicles.
- Utilizes Azure Maps for realistic route and position data (being improved to add more flexibility).
Dependencies
- Newtonsoft.Json
- Newtonsoft.Json.Schema
- Bogus
How to Use
Default random data generation
C# code :
...
JSchema schema;
using (StreamReader file = File.OpenText(@"Schemas\telemetry-message-schema.json"))
using (JsonTextReader reader = new JsonTextReader(file))
{
schema = JSchema.Load(reader);
}
var generatedJsonData1 = JsonSchemaDataGenerator.Generate(schema);
...
JSON Schema example:
{
"$schema": "http://json-schema.org/draft-04/schema",
"title": "JSON Schema for my JSON file format",
"type": "object",
"properties": {
"name": {
"type": "string"
},
"messageType": {
"type": "string",
"enum": [ "data" ]
},
"date": {
"type": "string",
"format": "date-time"
},
"pressure": {
"type": "number"
},
"temperature": {
"type": "number",
"minimum": -10.2,
"maximum": 52.8
},
"versions": {
"type": "array",
"description": "An array of version numbers.",
"minItems": 1,
"items": {
"type": "number"
}
}
}
}
GPS related data
This version includes features to create coherent paths for moving vehicles, cinlduing:
- regular GPS position following a logical path, between provided start and end points
- vehicle speed according to the starting point, the end point, time and current position
public interface IGPSDataService
{
Task<List<(double lat, double lng)>> GetRoutePoints(GPSCoordinates gpsOrigin, GPSCoordinates gpsDestination);
Task<RouteResponse> GetRoute(GPSCoordinates gpsOrigin, GPSCoordinates gpsDestination);
Task<(double lat, double lng)> GetPoint(string address);
Task<RouteResponseWithCinematicData> GetRouteResponseWithSimulatedCinematicDataAsync(GPSCoordinates origin, GPSCoordinates destination);
}
The service relies on Azure Maps to calculate the path between two points. So, the related Azure Maps key should be provided in the configuration file.
An extension method configures the IoC/DI for the service.
IoC/DI configuration:
...
var externalMapsServiceSettings = _configurationRoot.GetSection(nameof(ExternalMapsServiceSettings));
_services.AddGPSDataService(externalMapsServiceSettings.Get<ExternalMapsServiceSettings>());
...
appsettings.json
{
"ExternalMapsServiceSettings": {
"BaseUrl": "https://atlas.microsoft.com",
"DirectionsUrl": "route/directions/json",
"SnapToRoadsUrl": "",
"SearchUrl": "geocode",
"ApiKey": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
}
}
Get Route Points
...
var gpsDataService = _serviceProvider.GetRequiredService<IGPSDataService>();
var origin = await gpsDataService.GetPoint("1600 Amphitheatre Parkway, Mountain View, CA");
var destination = await gpsDataService.GetPoint("150 Market Street, San Francisco, CA");
var result = await gpsDataService.GetRoutePoints(
new Models.GPS.GPSCoordinates
{
Latitude = origin.lat,
Longitude = origin.lng
},
new Models.GPS.GPSCoordinates
{
Latitude = destination.lat,
Longitude = destination.lng
});
...
Get Route
...
var gpsDataService = _serviceProvider.GetRequiredService<IGPSDataService>();
var origin = await gpsDataService.GetPoint("1600 Amphitheatre Parkway, Mountain View, CA");
var destination = await gpsDataService.GetPoint("150 Market Street, San Francisco, CA");
var result = await gpsDataService.GetRoute(
new Models.GPS.GPSCoordinates
{
Latitude = origin.lat,
Longitude = origin.lng
},
new Models.GPS.GPSCoordinates
{
Latitude = destination.lat,
Longitude = destination.lng
});
...
Get route with simulated cinematic data
...
var gpsDataService = _serviceProvider.GetRequiredService<IGPSDataService>();
var origin = await gpsDataService.GetPoint("1600 Amphitheatre Parkway, Mountain View, CA");
var destination = await gpsDataService.GetPoint("150 Market Street, San Francisco, CA");
var result = await gpsDataService.GetRouteResponseWithSimulatedCinematicDataAsync(
new Models.GPS.GPSCoordinates
{
Latitude = origin.lat,
Longitude = origin.lng
},
new Models.GPS.GPSCoordinates
{
Latitude = destination.lat,
Longitude = destination.lng
});
...
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. 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. |
-
net10.0
- Bogus (>= 35.6.5)
- Bogus.Healthcare (>= 35.6.5)
- Bogus.Locations (>= 35.6.5)
- Microsoft.Extensions.Http (>= 10.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.0)
- Microsoft.Extensions.Options (>= 10.0.0)
- Newtonsoft.Json (>= 13.0.4)
- Newtonsoft.Json.Schema (>= 4.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.10.2556 | 30 | 1/24/2026 |
| 0.10.2555 | 28 | 1/24/2026 |
| 0.10.2510 | 211 | 11/23/2025 |
| 0.10.2424 | 183 | 11/15/2025 |
| 0.4.2422 | 177 | 11/15/2025 |
| 0.4.2403 | 228 | 1/11/2025 |
| 0.4.2125-alpha | 239 | 7/11/2024 |
| 0.4.2123-alpha | 165 | 7/9/2024 |
| 0.4.2121-alpha | 178 | 7/9/2024 |
| 0.3.2009 | 238 | 6/14/2024 |
| 0.3.7 | 555 | 11/18/2023 |
| 0.1.5 | 751 | 4/30/2023 |
| 0.1.4 | 907 | 11/23/2022 |
| 0.1.3 | 968 | 10/30/2022 |
| 0.1.2 | 913 | 10/16/2022 |
| 0.1.1 | 923 | 10/16/2022 |
| 0.1.0 | 937 | 10/16/2022 |