{"id":19508680,"url":"https://github.com/commit451/frenchie","last_synced_at":"2025-10-04T23:11:08.322Z","repository":{"id":83213980,"uuid":"97649896","full_name":"Commit451/frenchie","owner":"Commit451","description":"Additional classes and extensions for Moshi","archived":false,"fork":false,"pushed_at":"2022-06-27T04:33:04.000Z","size":86,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-26T02:52:37.500Z","etag":null,"topics":["json","kotlin","moshi"],"latest_commit_sha":null,"homepage":null,"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/Commit451.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2017-07-18T22:38:56.000Z","updated_at":"2022-06-27T04:33:07.000Z","dependencies_parsed_at":"2023-03-01T21:00:32.905Z","dependency_job_id":null,"html_url":"https://github.com/Commit451/frenchie","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/Commit451/frenchie","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Commit451%2Ffrenchie","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Commit451%2Ffrenchie/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Commit451%2Ffrenchie/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Commit451%2Ffrenchie/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Commit451","download_url":"https://codeload.github.com/Commit451/frenchie/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Commit451%2Ffrenchie/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278386130,"owners_count":25978113,"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","status":"online","status_checked_at":"2025-10-04T02:00:05.491Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","moshi"],"created_at":"2024-11-10T23:08:58.503Z","updated_at":"2025-10-04T23:11:08.307Z","avatar_url":"https://github.com/Commit451.png","language":"Kotlin","readme":"# frenchie\nAdditional classes and extensions for [Moshi](https://github.com/square/moshi)\n\n[![Build Status](https://travis-ci.org/Commit451/frenchie.svg?branch=master)](https://travis-ci.org/Commit451/frenchie) [![](https://jitpack.io/v/Commit451/frenchie.svg)](https://jitpack.io/#Commit451/frenchie)\n\n## Gradle Dependency\nAdd the jitpack url to the project:\n```groovy\nallprojects {\n    repositories {\n        ...\n        maven { url \"https://jitpack.io\" }\n    }\n}\n```\nthen, in your app `build.gradle`\n```groovy\ndependencies {\n    implementation \"com.github.Commit451:frenchie:latest.version.here\"\n}\n```\n\n## Usage\nThe purpose of frenchie is to extend [Moshi](https://github.com/square/moshi) with classes and utilities that are useful, but may not make sense being included in Moshi itself.\n\n### ObjectOrArrayAdapterFactory\nSometimes, APIs are less than great, and they will include JSON that is not so predictable, and can either be a single element, or an array of elements. For example:\n```json\n{\n  \"cats\": {\n    \"name\": \"Sputnik\"\n  }\n}\n```\nand also:\n```json\n{\n  \"cats\": [{\n    \"name\": \"Sputnik\"\n  }]\n}\n```\nThis is a challenge to deal with with JSON parsing libraries. To overcome this, simply annotate your model that can have this field of either a list or object like so:\n```kotlin\nclass CatResponse {\n\n    @field:ObjectOrArray\n    lateinit var cats: List\u003cCat\u003e\n}\n```\nand when you are creating your `Moshi` instance:\n```kotlin\nMoshi.Builder()\n    .add(ObjectOrArrayAdapterFactory())\n    .build()\n```\n\n## Name\nfrenchie is named after the breed of the dog that [Moshi itself was named after](https://twitter.com/MoshiFrenchie), a French bulldog\n\nLicense\n--------\n\n    Copyright 2018 Commit 451\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","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcommit451%2Ffrenchie","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcommit451%2Ffrenchie","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcommit451%2Ffrenchie/lists"}