{"id":19711035,"url":"https://github.com/slackhq/moshi-gson-interop","last_synced_at":"2025-04-29T17:31:32.363Z","repository":{"id":38297541,"uuid":"297518185","full_name":"slackhq/moshi-gson-interop","owner":"slackhq","description":"An interop tool for safely mixing Moshi and Gson models in JSON serialization.","archived":false,"fork":false,"pushed_at":"2024-09-09T09:29:04.000Z","size":278,"stargazers_count":43,"open_issues_count":7,"forks_count":7,"subscribers_count":11,"default_branch":"main","last_synced_at":"2025-04-22T12:15:21.608Z","etag":null,"topics":["gson","java","json","kotlin","moshi"],"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/slackhq.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":".github/CODE_OF_CONDUCT.md","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}},"created_at":"2020-09-22T02:51:57.000Z","updated_at":"2024-06-21T15:02:37.000Z","dependencies_parsed_at":"2022-09-27T10:50:42.745Z","dependency_job_id":"cddd0a40-2081-4e58-b583-3dec5d0f34a1","html_url":"https://github.com/slackhq/moshi-gson-interop","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slackhq%2Fmoshi-gson-interop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slackhq%2Fmoshi-gson-interop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slackhq%2Fmoshi-gson-interop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slackhq%2Fmoshi-gson-interop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/slackhq","download_url":"https://codeload.github.com/slackhq/moshi-gson-interop/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251549249,"owners_count":21607376,"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":["gson","java","json","kotlin","moshi"],"created_at":"2024-11-11T22:09:35.530Z","updated_at":"2025-04-29T17:31:31.942Z","avatar_url":"https://github.com/slackhq.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# moshi-gson-interop\n\nA tool for bidirectional interop between Moshi and Gson.\n\nThis is targeted at codebases that are in the process of migrating from Gson _to_ Moshi and not a\ngeneral-purpose tool that should be used for other reasons.\n\n## Usage\n\nIn order to properly link two `Moshi` and `Gson` instances, you must pass two _complete_\ninstances (i.e. not intended to `newBuilder()` later) to `Moshi.interopWith()` and use\nthe returned instances.\n\n```kotlin\nval seedMoshi: Moshi = ...\nval seedGson: Gson = ...\n\n// Use the returned instances!\nval (moshi, gson) = seedMoshi.interopWith(seedGson)\n```\n\nBy default, the interop mechanism will attempt to best-guess which serializer to use based on a combination\nof things (see `DefaultMoshiClassChecker`'s kdoc). You can alternatively provide your own logic for this.\n\n### Advanced\n\nYou can use the `Moshi.interopBuilder()` extension to create an `InteropBuilder` for advanced usage and adding\nyour own `ClassChecker` logic.\n\n## Installation\n\n[![Maven Central](https://img.shields.io/maven-central/v/com.slack.moshi/gson-interop.svg)](https://mvnrepository.com/artifact/com.slack.moshi/gson-interop)\n```gradle\ndependencies {\n  implementation(\"com.slack.moshi:gson-interop:\u003cversion\u003e\")\n}\n```\n\nSnapshots of the development version are available in [Sonatype's `snapshots` repository][snap].\n\n## Caveats\n\n* JsonQualifiers on a type in a Gson class will not be passed on to Moshi, as Gson (and the various\n  tools around it) don't capture them.\n* Performance\n  * A Moshi adapter delegating to Gson should have no performance issues as it is able\n    to stream data directly.\n  * Streaming from Gson to Moshi will, however, be degraded as Gson has no equivalent\n    streaming APIs to Moshi's `nextSource()` or `valueSink()` APIs. This means that it\n    must either decode the entire source into an intermediary object (i.e. a Map, List,\n    etc) first when reading or encode the entire value into a JSON String first when writing.\n\n\nLicense\n--------\n\n    Copyright 2020 Slack Technologies, LLC\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n\n\n[snap]: https://oss.sonatype.org/content/repositories/snapshots/com/slack/moshi/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fslackhq%2Fmoshi-gson-interop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fslackhq%2Fmoshi-gson-interop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fslackhq%2Fmoshi-gson-interop/lists"}