{"id":25776541,"url":"https://github.com/mangatmodi/RandomJson","last_synced_at":"2026-08-13T09:30:15.688Z","repository":{"id":37270776,"uuid":"163420278","full_name":"mangatmodi/RandomJson","owner":"mangatmodi","description":"Provides a Kotlin/Java library to create a random json string","archived":false,"fork":false,"pushed_at":"2023-12-05T22:16:13.000Z","size":135,"stargazers_count":73,"open_issues_count":4,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2026-01-17T02:38:11.875Z","etag":null,"topics":["fuzzing","fuzzy-testing","json","testdatabuilder"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mangatmodi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2018-12-28T14:43:29.000Z","updated_at":"2025-06-18T03:36:14.000Z","dependencies_parsed_at":"2022-09-04T16:01:34.905Z","dependency_job_id":null,"html_url":"https://github.com/mangatmodi/RandomJson","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/mangatmodi/RandomJson","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mangatmodi%2FRandomJson","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mangatmodi%2FRandomJson/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mangatmodi%2FRandomJson/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mangatmodi%2FRandomJson/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mangatmodi","download_url":"https://codeload.github.com/mangatmodi/RandomJson/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mangatmodi%2FRandomJson/sbom","scorecard":{"id":614952,"data":{"date":"2025-08-11","repo":{"name":"github.com/mangatmodi/RandomJson","commit":"2a2425c5e1a3286f97c28ac9999eaf96f9fbeb4e"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.9,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":9,"reason":"binaries present in source code","details":["Warn: binary detected: gradle/wrapper/gradle-wrapper.jar:1"],"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 2/22 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.md:0","Info: FSF or OSI recognized license: MIT License: LICENSE.md:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 27 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"61 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-vmq6-5m68-f53m","Warn: Project is vulnerable to: GHSA-668q-qrv7-99fm","Warn: Project is vulnerable to: GHSA-6v67-2wr5-gvf4","Warn: Project is vulnerable to: GHSA-pr98-23f8-jwxv","Warn: Project is vulnerable to: GHSA-h46c-h94j-95f3","Warn: Project is vulnerable to: GHSA-wf8f-6423-gfxg","Warn: Project is vulnerable to: GHSA-27xj-rqx5-2255","Warn: Project is vulnerable to: GHSA-288c-cq4h-88gq","Warn: Project is vulnerable to: GHSA-4w82-r329-3q67","Warn: Project is vulnerable to: GHSA-57j2-w4cx-62h2","Warn: Project is vulnerable to: GHSA-58pp-9c76-5625","Warn: Project is vulnerable to: GHSA-5949-rw7g-wx7w","Warn: Project is vulnerable to: GHSA-5p34-5m6p-p58g","Warn: Project is vulnerable to: GHSA-5r5r-6hpj-8gg9","Warn: Project is vulnerable to: GHSA-5ww9-j83m-q7qx","Warn: Project is vulnerable to: GHSA-6fpp-rgj9-8rwc","Warn: Project is vulnerable to: GHSA-758m-v56v-grj4","Warn: Project is vulnerable to: GHSA-85cw-hj65-qqv9","Warn: Project is vulnerable to: GHSA-89qr-369f-5m5x","Warn: Project is vulnerable to: GHSA-8c4j-34r4-xr8g","Warn: Project is vulnerable to: GHSA-8w26-6f25-cm9x","Warn: Project is vulnerable to: GHSA-95cm-88f5-f2c7","Warn: Project is vulnerable to: GHSA-9gph-22xh-8x98","Warn: Project is vulnerable to: GHSA-9m6f-7xcq-8vf8","Warn: Project is vulnerable to: GHSA-9vvp-fxw6-jcxr","Warn: Project is vulnerable to: GHSA-c265-37vj-cwcc","Warn: Project is vulnerable to: GHSA-c2q3-4qrh-fm48","Warn: Project is vulnerable to: GHSA-cf6r-3wgc-h863","Warn: Project is vulnerable to: GHSA-cmfg-87vq-g5g4","Warn: Project is vulnerable to: GHSA-cvm9-fjm9-3572","Warn: Project is vulnerable to: GHSA-f3j5-rmmp-3fc5","Warn: Project is vulnerable to: GHSA-f9xh-2qgp-cq57","Warn: Project is vulnerable to: GHSA-fmmc-742q-jg75","Warn: Project is vulnerable to: GHSA-fqwf-pjwf-7vqv","Warn: Project is vulnerable to: GHSA-gjmw-vf9h-g25v","Warn: Project is vulnerable to: GHSA-gwp4-hfv6-p7hw","Warn: Project is vulnerable to: GHSA-gww7-p5w4-wrfv","Warn: Project is vulnerable to: GHSA-h3cw-g4mq-c5x2","Warn: Project is vulnerable to: GHSA-h4rc-386g-6m85","Warn: Project is vulnerable to: GHSA-h822-r4r5-v8jg","Warn: Project is vulnerable to: GHSA-j823-4qch-3rgm","Warn: Project is vulnerable to: GHSA-jjjh-jjxp-wpff","Warn: Project is vulnerable to: GHSA-m6x4-97wx-4q27","Warn: Project is vulnerable to: GHSA-mc6h-4qgp-37qh","Warn: Project is vulnerable to: GHSA-mph4-vhrx-mv67","Warn: Project is vulnerable to: GHSA-mx7p-6679-8g3q","Warn: Project is vulnerable to: GHSA-p43x-xfjf-5jhr","Warn: Project is vulnerable to: GHSA-q93h-jc49-78gg","Warn: Project is vulnerable to: GHSA-qjw2-hr98-qgfh","Warn: Project is vulnerable to: GHSA-qmqc-x3r4-6v39","Warn: Project is vulnerable to: GHSA-r3gr-cxrf-hg25","Warn: Project is vulnerable to: GHSA-r695-7vr9-jgc2","Warn: Project is vulnerable to: GHSA-rf6r-2c4q-2vwg","Warn: Project is vulnerable to: GHSA-rgv9-q543-rqg4","Warn: Project is vulnerable to: GHSA-rpr3-cw39-3pxh","Warn: Project is vulnerable to: GHSA-v3xw-c963-f5hc","Warn: Project is vulnerable to: GHSA-v585-23hc-c647","Warn: Project is vulnerable to: GHSA-vfqx-33qm-g869","Warn: Project is vulnerable to: GHSA-wh8g-3j2c-rqj5","Warn: Project is vulnerable to: GHSA-2qp4-g3q3-f92w","Warn: Project is vulnerable to: GHSA-cqj8-47ch-rvvq"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-21T03:39:36.084Z","repository_id":37270776,"created_at":"2025-08-21T03:39:36.084Z","updated_at":"2025-08-21T03:39:36.084Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":36602639,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-08-06T04:43:03.162Z","status":"online","status_checked_at":"2026-08-13T02:00:06.325Z","response_time":111,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fuzzing","fuzzy-testing","json","testdatabuilder"],"created_at":"2025-02-27T06:01:26.233Z","updated_at":"2026-08-13T09:30:15.414Z","avatar_url":"https://github.com/mangatmodi.png","language":"Kotlin","funding_links":[],"categories":["测试"],"sub_categories":[],"readme":"# RandomJson [![CodeFactor](https://www.codefactor.io/repository/github/mangatmodi/randomjson/badge)](https://www.codefactor.io/repository/github/mangatmodi/randomjson) [![Build Status](https://travis-ci.com/mangatmodi/RandomJson.svg?branch=master)](https://travis-ci.com/mangatmodi/RandomJson)\n\nProvides library to create a random json. Provides two implementation of json creation\n\n**[SampleJsonCreator](#SampleJsonCreator)**: Creates JSON string from a sample string.\n\n**[SimpleJsonCreator](#SimpleJsonCreator)**: Creates JSON string by taking number of required keys.\n\nSome important considerations:\n1. The random value generations could be customised by giving your own [implementation](#Customize-random-value-generators).\n2. The default given implementation is _thread-safe_. That means random strings can be [created](#Parallel-creation-of-random-strings) in different threads\n3. The library create one string for each call to `create()`. It does not provides any concurrency or streaming. It totally depends on the developer on how one \nwants to use it.    \n\n#### Java Interoperational\nThe library can be used in Java 10+. See [example](#Java-example).   \n### Usage\n#### Configuration\nFirst we need to create configuration for the creator. This config specify, the random value generators for each of the \nprimitive json type. The library includes some basic generator for each type.\n```kotlin\nval config =  RandomJsonConfig(\n    RandomDouble.threadLocalRandom(),\n    RandomInt.threadLocalRandom(),\n    RandomString.charArray(\"eusbwopw\".toCharArray(), 5),\n    RandomBoolean.uniform(),\n    RandomString.charArray(\"abcdefg\".toCharArray(), 5)\n    )\n\n```\n\n#### SampleJsonCreator\nCreates JSON string similar to `{\"key1\":{\"key2\":3}}` in structure but keys and values have random values.\n```kotlin\nval jsonCreator = RandomJsonCreator\n    .fromSampleString(\"\"\"{\"key1\":{\"key2\":3}}\"\"\", config, KeepKeys.No)\n    println(jsonCreator.create())            \n    \n```\nAbove prints\n```json\n{\"ggdb\":{\"faea\":1279812142}}\n```\n\n**Keep the same keys as the sample string**\nThe sample string creator can create json with same keys as the original json.\n```kotlin\n    val input = \"\"\"{\"key1\":{\"key2\":3}}\"\"\".trimIndent()\n\n    val jsonCreator = RandomJsonCreator\n        .fromSampleString(input, config, KeepKeys.YES)\n    println(jsonCreator.create())\n\n```    \nAbove prints\n```json\n{\"key1\":{\"key2\":2083614805}}\n```\n\nSee more [examples](https://github.com/mangatmodi/RandomJson/blob/master/examples/).\n#### SimpleJsonCreator \nCreates JSON string similar 2ith 10 keys, the structure of the json is decided by `RandomTypeSelector`,\nwhich specify which which type of json field will be added next. SimpleJsonCreator does not support \narrays or nested json. \n\n```kotlin\nval jsonCreator = RandomJsonCreator\n    .fromNumberOfKeys(10,config, RandomTypeSelector.uniform())\n    println(jsonCreator.create())            \n    \n```\n#### Customize random value generators\n\nIn the example below `DummyDoubleValue` implements `RandomDouble` to give `2.0`\nas the double value. So all the JSON strings created by `jsonCreator` below will contain `2.0` as double value\n```kotlin\nclass DummyDoubleValue:RandomDouble{\n    override fun next() =  2.0\n}\nval config =  RandomJsonConfig(\n    DummyDoubleValue(),\n    RandomInt.threadLocalRandom(),\n    RandomString.charArray(\"eusbwopw\".toCharArray(), 5),\n    RandomBoolean.uniform(),\n    RandomString.charArray(\"abcdefg\".toCharArray(), 5)\n    )\n\n\nval jsonCreator = RandomJsonCreator\n    .fromNumberOfKeys(10,config, RandomTypeSelector.uniform())\n    println(jsonCreator.create())            \n\n```\n\n#### Parallel creation of random strings\nIn the example below, we used kotlin's [coroutines](https://kotlinlang.org/docs/reference/coroutines/coroutines-guide.html)\n based `async-await` util to create 10 json strings in parallel.\n```kotlin\nval jsonCreator = RandomJsonCreator\n    .fromNumberOfKeys(10,config, RandomTypeSelector.uniform())\n            \nval tasks =  (1..10).map {\n    async {\n          println(jsonCreator.create())\n        }\n    }\n    \ntasks.forEach{ it.await()}\n\n```\n\n#### Java example\n```java\n        RandomJsonConfig config = new RandomJsonConfig(\n                RandomDouble.threadLocalRandom(),\n                RandomInt.threadLocalRandom(),\n                RandomString.charArray(\"eusbwopw\".toCharArray(), 5),\n                RandomBoolean.uniform(),\n                RandomString.charArray(\"abcdefg\".toCharArray(), 5)\n        );\n\n        RandomJsonCreator creator = RandomJsonCreator.fromSampleString(\n                \"{\\\"q\\\":1}\",\n                config,\n                KeepKeys.no()\n        );\n\n       System.out.println(creator.create())\n```\n### Install\nThe library could be installed from maven central\n\n**Maven**\n```maven\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.github.mangatmodi\u003c/groupId\u003e\n    \u003cartifactId\u003erandomjson\u003c/artifactId\u003e\n    \u003cversion\u003e2.1.2\u003c/version\u003e\n\u003c/dependency\u003e\n\n```\n\n**Gradle**\n```gradle\ncompile group: 'com.github.mangatmodi', name: 'randomjson', version: '2.1.2'\n```\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmangatmodi%2FRandomJson","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmangatmodi%2FRandomJson","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmangatmodi%2FRandomJson/lists"}