{"id":22437832,"url":"https://github.com/plannigan/ktor-moshi","last_synced_at":"2025-08-01T15:32:30.472Z","repository":{"id":57725075,"uuid":"276731448","full_name":"plannigan/ktor-moshi","owner":"plannigan","description":"Ktor feature that adds Moshi JSON serialization support","archived":false,"fork":false,"pushed_at":"2023-09-03T20:40:30.000Z","size":251,"stargazers_count":9,"open_issues_count":1,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-05-01T22:33:01.034Z","etag":null,"topics":["ktor","ktor-server"],"latest_commit_sha":null,"homepage":"","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/plannigan.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-07-02T19:40:31.000Z","updated_at":"2024-04-15T06:08:44.000Z","dependencies_parsed_at":"2022-09-11T20:20:40.266Z","dependency_job_id":null,"html_url":"https://github.com/plannigan/ktor-moshi","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plannigan%2Fktor-moshi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plannigan%2Fktor-moshi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plannigan%2Fktor-moshi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plannigan%2Fktor-moshi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/plannigan","download_url":"https://codeload.github.com/plannigan/ktor-moshi/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228389095,"owners_count":17912189,"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":["ktor","ktor-server"],"created_at":"2024-12-06T00:15:09.714Z","updated_at":"2025-08-01T15:32:30.455Z","avatar_url":"https://github.com/plannigan.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Kotlin](https://img.shields.io/badge/kotlin-2.2.0-blue.svg)](http://kotlinlang.org)\n[![CI](https://github.com/plannigan/ktor-moshi/actions/workflows/main.yaml/badge.svg?branch=main)](https://github.com/plannigan/ktor-moshi/actions/workflows/main.yaml)\n[![Maven Central](https://img.shields.io/maven-central/v/com.hypercubetools/ktor-moshi)][maven]\n[![codecov](https://codecov.io/gh/plannigan/ktor-moshi/branch/main/graph/badge.svg)](https://codecov.io/gh/plannigan/ktor-moshi)\n\n# Ktor-Moshi\n\n[Ktor][ktor] is a framework for building asynchronous servers and clients in connected systems. Ktor allows the\napplication to decide how data should be serialized/deserialized when sent over the network.\n\nKtor-Moshi allows an application to use [Moshi][moshi] when dealing with JSON content.\n\n## Usage\n\n### Server\n\nWhen implementing a server, the [ContentNegotiation][server_content_negotiation] plugin will convert the content. Below\nis an example of installing Moshi for content negotiation:\n\n```kotlin\ninstall(ContentNegotiation) {\n    moshi {\n        // Configure the Moshi.Builder here.\n        add(Date::class.java, Rfc3339DateJsonAdapter())\n    }\n}\n```\n\nA [Moshi.Builder][moshi_builder] is available inside the `moshi` block if it needs to be customized. In this example,\nMoshi's pre-build [RFC-3339 Date adapter][date_adapter] is added.\n\nAlternatively, if the application already has a `Moshi` instance, it can be provided instead of creating a new one.\n\n```kotlin\ninstall(ContentNegotiation) {\n    moshi(myExistingMoshiInstance)\n}\n```\n\nRefer to the [ContentNegotiation][server_content_negotiation] documentation for information on how to send and receive\nformatted data.\n\n### Client\n\nWhen implementing a client, the [ContentNegotiation][client_content_negotiation] plugin will convert the content. Below\nis an example of installing Moshi for serializing JSON content:\n\n```kotlin\nval client = HttpClient(HttpClientEngine) {\n    install(ContentNegotiation) {\n        moshi {\n            add(Rfc3339DateJsonAdapter())\n        }\n    }\n}\n```\n\nA [Moshi.Builder][moshi_builder] is available inside the `MoshiSerializer` block if it needs to be customized. In this\nexample, Moshi's pre-build [RFC-3339 Date adapter][date_adapter] is added.\n\nAlternatively, if the application already has a `Moshi` instance, it can be provided instead of creating a new one.\n\n```kotlin\nval client = HttpClient(HttpClientEngine) {\n    install(ContentNegotiation) {\n        moshi(myExistingMoshiInstance)\n    }\n}\n```\n\nRefer to the [ContentNegotiation][client_content_negotiation] documentation for information on how to send and receive\nformatted data.\n\n## Download\n\nAdd a Gradle dependency to your project:\n\nUsing the Kotlin DSL:\n\n```kotlin\nimplementation(\"com.hypercubetools:ktor-moshi:LATEST_VERSION\")\n```\n\nUsing the Groovy DSL:\n\n```groovy\nimplementation 'com.hypercubetools:ktor-moshi:LATEST_VERSION'\n```\n\n## Fork\n\n[Ryan Harter's `ktor-moshi`][old_repo] is the original source for this project. The project has been expanded since it's\ninitial state.\n\n[maven]: https://central.sonatype.com/artifact/com.hypercubetools/ktor-moshi/\n[ktor]: https://ktor.io/\n[moshi]: https://github.com/square/moshi/\n[server_content_negotiation]: https://ktor.io/docs/serialization.html\n[client_content_negotiation]: https://ktor.io/docs/serialization-client.html\n[moshi_builder]: https://square.github.io/moshi/1.x/moshi/com/squareup/moshi/Moshi.Builder.html\n[date_adapter]: https://github.com/square/moshi/tree/master/adapters#adapters\n[old_repo]: https://github.com/rharter/ktor-moshi\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplannigan%2Fktor-moshi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fplannigan%2Fktor-moshi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplannigan%2Fktor-moshi/lists"}