Skip to content

Conversation

@mechite
Copy link
Contributor

@mechite mechite commented Sep 20, 2025

This adds support for some annotations from both GSON & JSON-B, making it much smoother to swap in avaje-jsonb into projects using these.

It also adds [3] for Jackson + support for @JsonRawValue.

Here is an outline of supported features:

Avaje JSON-B Jackson Gson Jakarta JSON-B
@Json.Alias @JsonAlias @SerializedName(alternate=…)
@Json.Creator @JsonCreator @JsonbCreator
@Json.Ignore @JsonIgnore @Expose(serialize = false) [2] @JsonbTransient
@Json.Property @JsonProperty @SerializedName @JsonbProperty
@Json.Raw @JsonRawValue
@Json.Value @JsonValue [4] @JsonbValue [1]

[1] - Removed, see Page 35 @ JSON-B spec PDF
why this was removed I have no clue, but it should mean nobody is using it.

[2] - Gson also supports transient (which avaje already supports).

[3] - This PR also includes a check for empty string when using Jackson JsonProperty.
(wasn't sure how avaje handles this previously?)

package com.fasterxml.jackson.annotation;
//...
public @interface JsonProperty
//...
public final static String USE_DEFAULT_NAME = "";
//...
String value() default USE_DEFAULT_NAME;

(due to the above)

[4] - Removed in 415f286


note this pr is also my first time working with prisms
(@SentryMan — please review, and do not merge until we all agree this is a good feature to add)

It is important that the test suite is improved (#426 (review)).

@mechite mechite requested a review from SentryMan September 20, 2025 23:44
@rbygrave
Copy link
Contributor

Is this ready for review now?

@SentryMan
Copy link
Collaborator

even though find it pretty unlikely that anyone would publish a package using jakarta json that would need importing, it looks good to me.

@rbygrave rbygrave merged commit f15a361 into avaje:main Sep 22, 2025
5 checks passed
SentryMan added a commit that referenced this pull request Sep 22, 2025
@mechite mechite deleted the gson-jackson-jakarta branch October 6, 2025 02:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants