[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-3939":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":16,"forks30d":16,"starsTrendScore":19,"compositeScore":20,"rankGlobal":10,"rankLanguage":10,"license":21,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":22,"hasPages":24,"topics":25,"createdAt":10,"pushedAt":10,"updatedAt":26,"readmeContent":27,"aiSummary":28,"trendingCount":16,"starSnapshotCount":16,"syncStatus":29,"lastSyncTime":30,"discoverSource":31},3939,"gson","google\u002Fgson","google","A Java serialization\u002Fdeserialization library to convert Java Objects into JSON and back","",null,"Java",24206,4440,735,229,0,9,23,4,45,"Apache License 2.0",false,"main",true,[],"2026-06-12 02:00:56","# Gson\n\nGson is a Java library that can be used to convert Java Objects into their JSON representation. It can also be used to convert a JSON string to an equivalent Java object.\nGson can work with arbitrary Java objects including pre-existing objects that you do not have source-code of.\n\nThere are a few open-source projects that can convert Java objects to JSON. However, most of them require that you place Java annotations in your classes; something that you can not do if you do not have access to the source-code. Most also do not fully support the use of Java Generics. Gson considers both of these as very important design goals.\n\n> [!NOTE]\\\n> Gson is currently in maintenance mode; existing bugs will be fixed, but large new features will likely not be added. If you want to add a new feature, please first search for existing GitHub issues, or create a new one to discuss the feature and get feedback.\n\n> [!IMPORTANT]\\\n> Gson's main focus is on Java. Using it with other JVM languages such as Kotlin or Scala might work fine in many cases, but language-specific features such as Kotlin's non-`null` types or constructors with default arguments are not supported. This can lead to confusing and incorrect behavior.\\\n> When using languages other than Java, prefer a JSON library with explicit support for that language.\n\n> [!IMPORTANT]\\\n> Gson is not a recommended library for interacting with JSON on Android. The open-ended reflection in the Gson runtime doesn't play nicely with shrinking\u002Foptimization\u002Fobfuscation passes that Android release apps should perform.\\\n> If your app or library may be running on Android, consider using [Kotlin Serialization](https:\u002F\u002Fgithub.com\u002FKotlin\u002Fkotlinx.serialization\u002Fblob\u002Fmaster\u002Fdocs\u002Fbasic-serialization.md#basics) or [Moshi's Codegen](https:\u002F\u002Fgithub.com\u002Fsquare\u002Fmoshi?tab=readme-ov-file#codegen),\n> which use code generation instead of reflection. This avoids Gson's runtime crashes when optimizations are applied (usually due to the fields missing or being obfuscated), and results in faster performance on Android devices.\n> The Moshi APIs may be more familiar to users who already know Gson.\n> If you still want to use Gson and attempt to avoid these crashes, you can see how to do so [here](Troubleshooting.md#proguard-r8).\n\n### Goals\n  * Provide simple `toJson()` and `fromJson()` methods to convert Java objects to JSON and vice-versa\n  * Allow pre-existing unmodifiable objects to be converted to and from JSON\n  * Extensive support of Java Generics\n  * Allow custom representations for objects\n  * Support arbitrarily complex objects (with deep inheritance hierarchies and extensive use of generic types)\n\n### Download\n\nGradle:\n```gradle\ndependencies {\n  implementation 'com.google.code.gson:gson:2.14.0'\n}\n```\n\nMaven:\n```xml\n\u003Cdependency>\n  \u003CgroupId>com.google.code.gson\u003C\u002FgroupId>\n  \u003CartifactId>gson\u003C\u002FartifactId>\n  \u003Cversion>2.14.0\u003C\u002Fversion>\n\u003C\u002Fdependency>\n```\n\n[Gson jar downloads](https:\u002F\u002Fcentral.sonatype.com\u002Fartifact\u002Fcom.google.code.gson\u002Fgson) are available from Maven Central.\n\n![Build Status](https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgson\u002Factions\u002Fworkflows\u002Fbuild.yml\u002Fbadge.svg)\n\n### Requirements\n#### Minimum Java version\n- Gson 2.12.0 and newer: Java 8\n- Gson 2.9.0 to 2.11.0: Java 7\n- Gson 2.8.9 and older: Java 6\n\nDespite supporting older Java versions, Gson also provides a JPMS module descriptor (module name `com.google.gson`) for users of Java 9 or newer.\n\n#### JPMS dependencies (Java 9+)\nThese are the optional Java Platform Module System (JPMS) JDK modules which Gson depends on.\nThis only applies when running Java 9 or newer.\n\n- `java.sql` (optional since Gson 2.8.9)\\\nWhen this module is present, Gson provides default adapters for some SQL date and time classes.\n\n- `jdk.unsupported`, respectively, class `sun.misc.Unsafe` (optional)\\\nWhen this module is present, Gson can use the `Unsafe` class to create instances of classes without a no-args constructor.\nHowever, care should be taken when relying on this. `Unsafe` is not available in all environments and its usage has some pitfalls,\nsee [`GsonBuilder.disableJdkUnsafe()`](https:\u002F\u002Fjavadoc.io\u002Fdoc\u002Fcom.google.code.gson\u002Fgson\u002Flatest\u002Fcom.google.gson\u002Fcom\u002Fgoogle\u002Fgson\u002FGsonBuilder.html#disableJdkUnsafe()).\n\n#### Minimum Android API level\n\n- Gson 2.11.0 and newer: API level 21\n- Gson 2.10.1 and older: API level 19\n\nOlder Gson versions may also support lower API levels, however this has not been verified.\n\n### Documentation\n  * [API Javadoc](https:\u002F\u002Fwww.javadoc.io\u002Fdoc\u002Fcom.google.code.gson\u002Fgson): Documentation for the current release\n  * [User guide](UserGuide.md): This guide contains examples on how to use Gson in your code\n  * [Troubleshooting guide](Troubleshooting.md): Describes how to solve common issues when using Gson\n  * [Releases and change log](https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgson\u002Freleases): Latest releases and changes in these versions; for older releases see [`CHANGELOG.md`](CHANGELOG.md)\n  * [Design document](GsonDesignDocument.md): This document discusses issues we faced while designing Gson. It also includes a comparison of Gson with other Java libraries that can be used for Json conversion\n\nPlease use the ['gson' tag on StackOverflow](https:\u002F\u002Fstackoverflow.com\u002Fquestions\u002Ftagged\u002Fgson), [GitHub Discussions](https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgson\u002Fdiscussions) or the [google-gson Google group](https:\u002F\u002Fgroups.google.com\u002Fgroup\u002Fgoogle-gson) to discuss Gson or to post questions.\n\n### ProGuard \u002F R8\n\nSee the details in the related section in the [Troubleshooting guide](Troubleshooting.md#proguard-r8).\n\n### Related Content Created by Third Parties\n  * [Gson Tutorial](https:\u002F\u002Fwww.studytrails.com\u002Fjava\u002Fjson\u002Fjava-google-json-introduction\u002F) by `StudyTrails`\n  * [Gson Tutorial Series](https:\u002F\u002Ffuturestud.io\u002Ftutorials\u002Fgson-getting-started-with-java-json-serialization-deserialization) by `Future Studio`\n  * [Gson API Report](https:\u002F\u002Fabi-laboratory.pro\u002Fjava\u002Ftracker\u002Ftimeline\u002Fgson\u002F)\n\n### Building\n\nGson uses Maven to build the project:\n```\nmvn clean verify\n```\n\nJDK 17 or newer is required for building, JDK 21 is recommended. Newer JDKs are currently not supported for building (but are supported when _using_ Gson).\n\n### Contributing\n\nSee the [contributing guide](https:\u002F\u002Fgithub.com\u002Fgoogle\u002F.github\u002Fblob\u002Fmaster\u002FCONTRIBUTING.md).\\\nPlease perform a quick search to check if there are already existing issues or pull requests related to your contribution.\n\nKeep in mind that Gson is in maintenance mode. If you want to add a new feature, please first search for existing GitHub issues, or create a new one to discuss the feature and get feedback.\n\n### License\n\nGson is released under the [Apache 2.0 license](LICENSE).\n\n```\nCopyright 2008 Google Inc.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http:\u002F\u002Fwww.apache.org\u002Flicenses\u002FLICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n\n### Disclaimer\n\nThis is not an officially supported Google product.\n","Gson 是一个 Java 库，用于将 Java 对象转换为 JSON 格式字符串及反向操作。其核心功能包括提供简单的 `toJson()` 和 `fromJson()` 方法实现对象与 JSON 之间的转换，并支持处理包含复杂继承关系和泛型类型的对象。Gson 的一大特点是不需要在类中添加额外的注解就能处理现有的不可修改对象，这使得它在面对第三方库或遗留系统时尤为有用。此外，Gson 对 Java 泛型的支持也十分全面。尽管如此，对于 Android 开发者来说，由于 Gson 使用了反射机制，可能会影响应用的性能优化过程，因此建议使用 Kotlin Serialization 或 Moshi 等更适合 Android 平台的替代方案。Gson 适用于需要灵活处理 Java 对象序列化\u002F反序列化的场景，特别是在无法直接修改源代码的情况下。",2,"2026-06-11 02:57:16","top_language"]