{"id":13659333,"url":"https://github.com/mpetuska/kon","last_synced_at":"2025-10-19T07:03:44.564Z","repository":{"id":38146506,"uuid":"417156746","full_name":"mpetuska/kon","owner":"mpetuska","description":"Kotlin Object Notation - Lightweight DSL to build fluid JSON trees","archived":false,"fork":false,"pushed_at":"2024-09-03T22:10:34.000Z","size":494,"stargazers_count":46,"open_issues_count":12,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-24T19:55:44.768Z","etag":null,"topics":["json","kotlin","multiplatform"],"latest_commit_sha":null,"homepage":"https://mpetuska.github.io/kon","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mpetuska.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["mpetuska"]}},"created_at":"2021-10-14T14:12:41.000Z","updated_at":"2025-02-08T23:30:34.000Z","dependencies_parsed_at":"2024-01-17T03:16:14.906Z","dependency_job_id":"d5d1cec9-0bb8-4d0b-9d54-3f48d0f9c1d6","html_url":"https://github.com/mpetuska/kon","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":"mpetuska/template-kmp-library","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpetuska%2Fkon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpetuska%2Fkon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpetuska%2Fkon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpetuska%2Fkon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mpetuska","download_url":"https://codeload.github.com/mpetuska/kon/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241739429,"owners_count":20012101,"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":["json","kotlin","multiplatform"],"created_at":"2024-08-02T05:01:07.613Z","updated_at":"2025-10-19T07:03:39.513Z","avatar_url":"https://github.com/mpetuska.png","language":"Kotlin","funding_links":["https://github.com/sponsors/mpetuska"],"categories":["Libraries"],"sub_categories":["🗃 Serializer"],"readme":"[![Slack chat](https://img.shields.io/badge/kotlinlang-chat-green?logo=slack\u0026style=flat-square)](https://kotlinlang.slack.com/team/UL1A5BA2X)\n[![Dokka docs](https://img.shields.io/badge/docs-dokka-orange?style=flat-square\u0026logo=kotlin)](http://mpetuska.github.io/kon)\n[![Version maven-central](https://img.shields.io/maven-central/v/dev.petuska/kon?logo=apache-maven\u0026style=flat-square)](https://mvnrepository.com/artifact/dev.petuska/kon/latest)\n\n# Kotlin Object Notation\n\nLightweight kotlin MPP DSL for building JSON trees\n\n## Setup\n\nJust drop the dependency in your `commonMain` sourceSet\n\n```kotlin\nkotlin {\n  sourceSets {\n    commonMain {\n      dependencies {\n        implementation(\"dev.petuska:kon:_\")\n      }\n    }\n  }\n}\n```\n\n### Usage\n\nBuild the object map via `kobj` builder function. Built object overrides `Any::toString` function to return proper json\nrepresentation of the underlying structure. Currently, supported kotlin types for json output are the following:\n\n* Map\n* Array\n* Collection\n* KObject\n* KArray\n* Number\n* Unsigned Number\n* String\n* Boolean\n* null\n* Pair\n* Triple\n\n```kotlin\nval json: KON = kobj {\n  \"str\" to \"string\"\n  \"number\" to 420\n  \"boolean\" to true\n  \"object\" {\n    \"str\" to \"string\"\n    \"number\" to 1\n    \"pair\" to (1 to null)\n    \"triple\" to Triple(1, \"2\", 3)\n    \"boolean\" to true\n    \"withArray\" [1, \"2\"]\n    \"nested\" {\n      \"stillGood\" to true\n      \"nullable\" to null\n    }\n  }\n  \"consistentObject\" to {\n    \"nice?\" to 69\n  }\n  \"array\"[\n      1,\n      \"2\",\n      true,\n      karr[1, \"2\", false],\n      kobj {\n        \"inner\" to true\n      }\n  ]\n  \"singleIntArray\".to[1]\n  \"singleIntArray2\" to karr[1]\n}\njson.toString() // Will return json string\njson.toJS() // Only available on js target. Will return JS Json object\nval jsonObject = json.toJsonObject() // Requires kon-serialization dependency. Will return kotlinx.serialization JsonObject.\njsonObject.toKObject() // Requires kon-serialization dependency. Will return KON KObject.\n```\n\n### Modules\n\n* [kon](./) - wrapper module bringing all the other modules as transitive dependencies\n* [kon-core](./lib/kon-core) - core implementation module\n* [kon-serialization](./lib/kon-serialization) - kotlinx-serialization interop module\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmpetuska%2Fkon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmpetuska%2Fkon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmpetuska%2Fkon/lists"}