tag | 1cbf144e9ff00865d8b23cd1c5d44b6c60dc60b3 | |
---|---|---|
tagger | Xin Li <delphij@google.com> | Wed Apr 24 20:15:25 2024 -0700 |
object | df0635d076c8cb792e076c1cf5c96dceed4759c5 |
aml_odp_341610000 (11382236,com.google.android.go.ondevicepersonalization,com.google.android.ondevicepersonalization)
commit | df0635d076c8cb792e076c1cf5c96dceed4759c5 | [log] [tgz] |
---|---|---|
author | Sorin Basca <sorinbasca@google.com> | Thu Feb 09 10:42:05 2023 +0000 |
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | Thu Feb 09 10:42:05 2023 +0000 |
tree | 5bb24177aa3ca081a637386494cd14537ba5a06b | |
parent | 51c71e6db3e725457c9b8a402ce57e478e8c145a [diff] | |
parent | 6b9b19dd82ee6047f3cc76d3537dd378861f3e93 [diff] |
Pin tradefed dependencies to Java 11 am: 2460ec8d65 am: 65e1b11195 am: 6b9b19dd82 Original change: https://android-review.googlesource.com/c/platform/external/gson/+/2419109 Change-Id: I24b18d4cb4339b8d5de9dad4c4fbc66729a3255f Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Gson 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. Gson can work with arbitrary Java objects including pre-existing objects that you do not have source-code of.
There 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.
:information_source: 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.
toJson()
and fromJson()
methods to convert Java objects to JSON and vice-versaGradle:
dependencies { implementation 'com.google.code.gson:gson:2.10' }
Maven:
<dependency> <groupId>com.google.code.gson</groupId> <artifactId>gson</artifactId> <version>2.10</version> </dependency>
Gson jar downloads are available from Maven Central.
Despite supporting older Java versions, Gson also provides a JPMS module descriptor (module name com.google.gson
) for users of Java 9 or newer.
These are the optional Java Platform Module System (JPMS) JDK modules which Gson depends on. This only applies when running Java 9 or newer.
java.sql
(optional since Gson 2.8.9)
When this module is present, Gson provides default adapters for some SQL date and time classes.
jdk.unsupported
, respectively class sun.misc.Unsafe
(optional)
When this module is present, Gson can use the Unsafe
class to create instances of classes without no-args constructor. However, care should be taken when relying on this. Unsafe
is not available in all environments and its usage has some pitfalls, see GsonBuilder.disableJdkUnsafe()
.
Please use the ‘gson’ tag on StackOverflow or the google-gson Google group to discuss Gson or to post questions.
StudyTrails
Future Studio
Gson is released under the Apache 2.0 license.
Copyright 2008 Google Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
This is not an officially supported Google product.