{"id":21187684,"url":"https://github.com/holgerbrandl/jsonbuilder","last_synced_at":"2025-06-11T11:38:01.844Z","repository":{"id":57720059,"uuid":"179441305","full_name":"holgerbrandl/jsonbuilder","owner":"holgerbrandl","description":"A small artefact to build json with kotlin","archived":false,"fork":false,"pushed_at":"2023-01-01T13:18:35.000Z","size":79,"stargazers_count":19,"open_issues_count":1,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-03T07:51:39.927Z","etag":null,"topics":["dsl","json","kotlin"],"latest_commit_sha":null,"homepage":null,"language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/holgerbrandl.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-04-04T07:06:50.000Z","updated_at":"2025-04-17T08:20:38.000Z","dependencies_parsed_at":"2023-01-31T22:45:55.447Z","dependency_job_id":null,"html_url":"https://github.com/holgerbrandl/jsonbuilder","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holgerbrandl%2Fjsonbuilder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holgerbrandl%2Fjsonbuilder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holgerbrandl%2Fjsonbuilder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holgerbrandl%2Fjsonbuilder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/holgerbrandl","download_url":"https://codeload.github.com/holgerbrandl/jsonbuilder/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holgerbrandl%2Fjsonbuilder/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":258909350,"owners_count":22776694,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["dsl","json","kotlin"],"created_at":"2024-11-20T18:39:52.324Z","updated_at":"2025-06-11T11:38:01.800Z","avatar_url":"https://github.com/holgerbrandl.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jsonbuilder for Kotlin\n\n`jsonbuilder` is a small artifact that serves a single purpose: It allows to create json using an idiomatic [kotlin](https://kotlinlang.org/) builder DSL.\n\n## Example\n\n```\nval myJson = json {\n        \"size\" to 0\n        \"array\" to arrayOf(1,2,3)\n        \"aggs\" to {\n            \"num_destinations\" to {\n                \"cardinality\" to {\n                    \"field\" to \"DestCountry\"\n                }\n            }\n        }\n    }\n```\n\nwhich will result in the following json structure:\n```\n{\n  \"size\": 0,\n  \"array\": [\n    1,\n    2,\n    3\n  ],\n  \"aggs\": {\n    \"num_destinations\": {\n      \"cardinality\": {\n        \"field\": \"DestCountry\"\n      }\n    }\n  }\n}\n```\n\nBoth arrays and nested elements are supported without additional functions/constructs.\n\n## Setup\n\n### Gradle\nTo get started simply add it as a dependency in your `build.gradle`:\n```\ncompile \"com.github.holgerbrandl:jsonbuilder:0.10\"\n```\n\n### Development Snapshots\n\nYou can also use [JitPack with Maven or Gradle](https://jitpack.io/#holgerbrandl/jsonbuilder) to build the latest snapshot as a dependency in your project.\n\n```groovy\nrepositories {\n    maven { url 'https://jitpack.io' }\n}\ndependencies {\n        compile 'com.github.holgerbrandl:jsonbuilder:-SNAPSHOT'\n}\n```\n\n\n### How to build?\n\nTo build and install it into your local maven cache, simply clone the repo and run\n```bash\n./gradlew install\n```\n\n## Documentation\n\nThis `README.md`. Feel welcome to file tickets about missing pieces in the docs.\n\n\n## How to contribute?\n\nFeel welcome to post ideas, suggestions and criticism to our [tracker](https://github.com/holgerbrandl/jsonbuilder/issues).\n\nWe always welcome pull requests. :-)\n\nYou could also show your spiritual support by just upvoting `jsonbuilder` here on github.\n\n## References\n\nThis library is built using https://github.com/stleary/JSON-java\n\n\nOther references\n* https://stackoverflow.com/questions/41861449/kotlin-dsl-for-creating-json-objects-without-creating-garbage\n* https://github.com/SalomonBrys/Kotson\n* \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fholgerbrandl%2Fjsonbuilder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fholgerbrandl%2Fjsonbuilder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fholgerbrandl%2Fjsonbuilder/lists"}