Oct 15, 2023
4 minute read

Introducing the Dadroit JSON Generator VSCode Extension


Developers and data engineers often require a variety of JSON data samples, when navigating through critical domains such as ETL process testing, API development and testing, and schema validation.

Discover how the Dadroit JSON Generator, now available as a VSCode Extension, is crafted to cater to these tasks, prioritizing simplicity and utility throughout your developmental journey. Targeting developers needing reliable JSON test data files, the extension simplifies data creation to ensure a smooth developmental expedition.

Begin by installing the extension from the VSCode Marketplace.

The Dadroit: Generate JSON Sample command is an instant route to generate JSON mock data, utilizing a predefined template implanted within the extension as a sample. Upon execution, the template used for this command will be opened in the VSCode editor for you to see through the syntax of this templating language:

Example of utilizing a sample JSON template within the Dadroit JSON Generator VSCode Extension for JSON test data creation.

Here is the result JSON file generated by the default sample command:

Visual output of the generated JSON data using the Dadroit JSON Generator VSCode Extension.
The result JSON file opened in Dadroit JSON Viewer.

The Dadroit: Generate JSON command is your gateway to crafting your custom JSON sample data that aligns with your specific project necessities. This command requires you to have a template sample, which you can write by utilizing our JSON Generator's template language. You can learn more about the template language in the following section.

We’ve designed an elaborate template language to be utilized as the blueprint in the JSON data generation process.

This template language facilitates straightforward JSON templating while maintaining a blend of simplicity and customization through versatile features like Loops, Variants, and mathematical operations like Random, Count, Range, Min, and Max. You can get some ideas by checking out available sample templates.

This extension enables you to create precise, project-specific JSON data with customized schema templates, ensuring both flexibility and exactness for your mock data needs, and the toolset has more to offer for you to do so.

Utilize the $Loop syntax in the template language to efficiently create dynamic JSON dummy data. Simply define a loop with a specified range using the $From and $To fields. This way you can generate multiple data entries in one go, making it possible for you to create large, accurate JSON outputs aligned with your project’s schema and requirements.

Leverage the $Random function within the template syntax, to introduce variety into your generated JSON data, providing an extended, realistic data set for thorough testing.

Here you can see an example template for the $Loop and $Random syntaxes:

{
	"Hi": {
		"$Loop": {
			"$From": 1,
			"$To": 10,
			"$Block": {
				"Message": {
					"$Format": {
						"$Template": {"$Random": ["Hi ? and ?", "Hello? or ?"]},
						"$Value": [
						{"$Random": ["Jim", "Jack", "Jake", "Jamie"]},
						{"$Random": ["Julia", "Jessica"]}
						]
					}
				}
			}
		}
	}
}

The result of using this template with the Dadroit: Generate JSON command would be something like this:

Example output showcasing the successful generation of structured JSON data using the “Dadroit: Generate JSON Sample” command, presented in the Dadroit JSON Viewer.
The result JSON file opened in Dadroit JSON Viewer.

Dig deeper into the capabilities of the random function and other syntaxes defined in the template language in our extended blog post, exploring how variability enriches your testing scenarios. Choose to craft your own JSON data with the Dadroit JSON Generator VSCode Extension, or explore other available open datasets for inspiration.

Join us in enhancing the Dadroit JSON Generator by contributing templates, reporting issues, and providing feedback through our GitHub issues. Your input is crucial in refining and expanding our JSON data generation capabilities. Enjoy crafting your JSON!