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
                    
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="JMI.Json.Data" Version="0.10.2556" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="JMI.Json.Data" Version="0.10.2556" />
                    
Directory.Packages.props
<PackageReference Include="JMI.Json.Data" />
                    
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 JMI.Json.Data --version 0.10.2556
                    
#r "nuget: JMI.Json.Data, 0.10.2556"
                    
#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.
#:package JMI.Json.Data@0.10.2556
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=JMI.Json.Data&version=0.10.2556
                    
Install as a Cake Addin
#tool nuget:?package=JMI.Json.Data&version=0.10.2556
                    
Install as a Cake Tool

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"
      }
    }
  }
}

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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