Go to file
dependabot[bot] 243f5e1126
Bump jackson-databind from 2.13.4 to 2.13.4.1 (#2222)
Bumps [jackson-databind](https://github.com/FasterXML/jackson) from 2.13.4 to 2.13.4.1.
- [Release notes](https://github.com/FasterXML/jackson/releases)
- [Commits](https://github.com/FasterXML/jackson/commits)

---
updated-dependencies:
- dependency-name: com.fasterxml.jackson.core:jackson-databind
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-13 16:19:08 -07:00
.github Disable Maven transfer progress for GitHub workflows (#2206) 2022-09-27 23:05:49 -07:00
examples/android-proguard-example Use diamond operator when creating generic instances (#2104) 2022-04-17 15:27:21 -07:00
extras Fix incorrect HTML headings in Javadoc (#2200) 2022-09-24 17:02:11 -07:00
gson Small adjustments to the new record code. (#2219) 2022-10-12 14:24:36 -07:00
lib moved lib at the top-level to share eclipse styles. 2008-09-01 03:27:34 +00:00
metrics Bump jackson-databind from 2.13.4 to 2.13.4.1 (#2222) 2022-10-13 16:19:08 -07:00
proto Build on JDK 17 as well as 11. (#2198) 2022-09-23 14:33:28 -07:00
.gitignore Add IDEA generated classes folder to gitignore (#1538) 2019-10-04 13:37:41 -07:00
CHANGELOG.md Update CHANGELOG.md with 2.9.1 changes. 2022-07-31 14:43:17 -07:00
GsonDesignDocument.md Update GsonDesignDocument.md 2017-03-23 17:58:52 -04:00
LICENSE Add full license text for Apache License 2.0 2015-11-27 16:42:01 -05:00
pom.xml Follow-up for record test build changes (#2207) 2022-09-27 23:02:15 -07:00
README.md Update CHANGELOG.md with 2.9.1 changes. 2022-07-31 14:43:17 -07:00
ReleaseProcess.md Remove usage of oss-parent Maven parent and update ReleaseProcess.md (#2159) 2022-09-06 16:26:53 -07:00
UserGuide.md Mention in User Guide alternative for Gson versions without fromJson(..., TypeToken) (#2209) 2022-09-30 07:57:02 -07:00

Gson

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.

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.

Goals

  • Provide simple toJson() and fromJson() methods to convert Java objects to JSON and vice-versa
  • Allow pre-existing unmodifiable objects to be converted to and from JSON
  • Extensive support of Java Generics
  • Allow custom representations for objects
  • Support arbitrarily complex objects (with deep inheritance hierarchies and extensive use of generic types)

Download

Gradle:

dependencies {
  implementation 'com.google.code.gson:gson:2.9.1'
}

Maven:

<dependency>
  <groupId>com.google.code.gson</groupId>
  <artifactId>gson</artifactId>
  <version>2.9.1</version>
</dependency>

Gson jar downloads are available from Maven Central.

Build Status

Requirements

Minimum Java version

  • Gson 2.9.0 and newer: Java 7
  • Gson 2.8.9 and older: Java 6

Despite supporting older Java versions, Gson also provides a JPMS module descriptor (module name com.google.gson) for users of Java 9 or newer.

JPMS dependencies (Java 9+)

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().

Documentation

  • API Javadoc: Documentation for the current release
  • User guide: This guide contains examples on how to use Gson in your code.
  • Change log: Changes in the recent versions
  • Design document: 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

Please use the 'gson' tag on StackOverflow or the google-gson Google group to discuss Gson or to post questions.

License

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.

Disclaimer

This is not an officially supported Google product.