All Projects → mpetuska → kon

mpetuska / kon

Licence: Apache-2.0 license
Kotlin Object Notation - Lightweight DSL to build fluid JSON trees

Programming Languages

kotlin
9241 projects
shell
77523 projects

Projects that are alternatives of or similar to kon

BitSrunLoginGo
深澜校园网登录程序 Go 语言版,适用于路由器、windows、linux 等。提供对 OpenWrt、Docker、Go Module 的支持
Stars: ✭ 112 (+180%)
Mutual labels:  multiplatform
minimal-http-server
Basic http server
Stars: ✭ 26 (-35%)
Mutual labels:  multiplatform
Multiplatform-Log
Kotlin Multi Platform Logger, for android an ios : Logcat & print
Stars: ✭ 49 (+22.5%)
Mutual labels:  multiplatform
matador
Take your appclication by the horns
Stars: ✭ 59 (+47.5%)
Mutual labels:  multiplatform
fourinarow-app
An online version of the popular game four in a row, written in Flutter + Dart on the client and Rust on the server side.
Stars: ✭ 23 (-42.5%)
Mutual labels:  multiplatform
Portable-WebDAV-Library
Moved to codeberg.org - https://codeberg.org/DecaTec/Portable-WebDAV-Library - The Portable WebDAV Library is a strongly typed, async WebDAV client library which is fully compliant to RFC 4918, RFC 4331 and "Additional WebDAV Collection Properties". It is implemented as .NETStandard 1.1 library in oder to be used on any platform supporting .NETS…
Stars: ✭ 45 (+12.5%)
Mutual labels:  multiplatform
sliding-puzzle
Sliding puzzle game implemented in Scala / Scala.js / JavaFX
Stars: ✭ 25 (-37.5%)
Mutual labels:  multiplatform
me
A Jetpack Compose Kotlin Multiplatform WYSIWYG blog editor
Stars: ✭ 62 (+55%)
Mutual labels:  multiplatform
cppsh
Simple script, which acts as "interpreter" for single C++ files
Stars: ✭ 13 (-67.5%)
Mutual labels:  multiplatform
PopKorn
DI can be simple. Forget about modules and components. Just use it!
Stars: ✭ 139 (+247.5%)
Mutual labels:  multiplatform
blend2d-python
Cython wrapper for Blend2D
Stars: ✭ 13 (-67.5%)
Mutual labels:  multiplatform
minigdx
Minimalist Game Framework using Kotlin Multiplatform
Stars: ✭ 136 (+240%)
Mutual labels:  multiplatform
kmp-web-wizard
Wizard for Kotlin Multiplatform
Stars: ✭ 164 (+310%)
Mutual labels:  multiplatform
rawDiag
Brings Orbitrap Mass Spectrometry Data to Life; Multi-platform, Fast and Colorful R package.
Stars: ✭ 29 (-27.5%)
Mutual labels:  multiplatform
ErpNet.FP
ErpNet.FP is a light-weight cross-platform Http server facilitating printing to fiscal printers through simple JSON Api.
Stars: ✭ 75 (+87.5%)
Mutual labels:  multiplatform
kmm-production-sample
This is an open-source, mobile, cross-platform application built with Kotlin Multiplatform Mobile. It's a simple RSS reader, and you can download it from the App Store and Google Play. It's been designed to demonstrate how KMM can be used in real production projects.
Stars: ✭ 1,476 (+3590%)
Mutual labels:  multiplatform
kgql
GraphQL Document wrapper generator for Kotlin Multiplatform Project and Android
Stars: ✭ 54 (+35%)
Mutual labels:  multiplatform
combatris
A "perfect" implementation of an old classic
Stars: ✭ 20 (-50%)
Mutual labels:  multiplatform
Decompose
Kotlin Multiplatform lifecycle-aware business logic components (aka BLoCs) with routing functionality and pluggable UI (Jetpack Compose, SwiftUI, JS React, etc.), inspired by Badoos RIBs fork of the Uber RIBs framework
Stars: ✭ 799 (+1897.5%)
Mutual labels:  multiplatform
vatsinator-legacy
An open-source Vatsim monitor
Stars: ✭ 12 (-70%)
Mutual labels:  multiplatform

Slack chat Dokka docs Version maven-central

Kotlin Object Notation

Lightweight kotlin MPP DSL for building JSON trees

Setup

Just drop the dependency in your commonMain sourceSet

kotlin {
  sourceSets {
    commonMain {
      dependencies {
        implementation("dev.petuska:kon:_")
      }
    }
  }
}

Usage

Build the object map via kobj builder function. Built object overrides Any::toString function to return proper json representation of the underlying structure. Currently, supported kotlin types for json output are the following:

  • Map
  • Array
  • Collection
  • KObject
  • KArray
  • Number
  • Unsigned Number
  • String
  • Boolean
  • null
  • Pair
  • Triple
val json: KON = kobj {
  "str" to "string"
  "number" to 420
  "boolean" to true
  "object" {
    "str" to "string"
    "number" to 1
    "pair" to (1 to null)
    "triple" to Triple(1, "2", 3)
    "boolean" to true
    "withArray" [1, "2"]
    "nested" {
      "stillGood" to true
      "nullable" to null
    }
  }
  "consistentObject" to {
    "nice?" to 69
  }
  "array"[
      1,
      "2",
      true,
      karr[1, "2", false],
      kobj {
        "inner" to true
      }
  ]
  "singleIntArray".to[1]
  "singleIntArray2" to karr[1]
}
json.toString() // Will return json string
json.toJS() // Only available on js target. Will return JS Json object
val jsonObject = json.toJsonObject() // Requires kon-serialization dependency. Will return kotlinx.serialization JsonObject.
jsonObject.toKObject() // Requires kon-serialization dependency. Will return KON KObject.

Modules

  • kon - wrapper module bringing all the other modules as transitive dependencies
  • kon-core - core implementation module
  • kon-serialization - kotlinx-serialization interop module
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].