Given a Json Schema, this generates a JSON payload with random or predefined data.
-
Duration format - RFC3339: ISO 8601 Collected ABNF
-
UUID formats.
To import this into your project, please add the following dependency:
<dependency>
<groupId>com.fibanez</groupId>
<artifactId>json-schema-content-generator</artifactId>
<version>{latest-version}</version>
</dependency>
import org.json.JSONObject;
import com.fibanez.jsonschema.content.JsonGenerator;
// ...
InputStream in = getClass().getClassLoader().getResourceAsStream("path/to/resource/schema.json");
JSONObject jsonObject = new JsonGenerator().generate(in);
String payload = jsonObject.toString();
-
Json-schema. This is an implementation of the JSON Schema Draft v4, Draft v6 and Draft v7 specifications. It uses the org.json API (created by Douglas Crockford) for representing JSON data.
-
Mockneat. This is an arbitrary data-generator open-source library written in Java.