52 questions
1
vote
1
answer
86
views
Jsonb.fromJson does not deserialize the Set produced from the JSON string generated by Jsonb.toJson(objectWithSet)
I have a sample object (included below) that is intended to be used with JAXB, JSON-B and JPA. I have writen some unit tests to verify the output but the JSON-B is giving me a little fuss. When I ...
1
vote
1
answer
289
views
Sort PostgreSQL JSONB object by object key's value
Given the following JSON (or JSONB) object:
{"apple": 13.1, "banana": 2.0, "zucchini": 7.2, "orange": 19.1}
I would like to sort the object keys by their ...
0
votes
1
answer
63
views
Extract values from jsonb and merge in to a dataset row
tableABC
I have a PostgreS table with above structure with a JSONB column. I'm using Spring JDBC to retrieve data.
Is there a way to get the row related data in the below structure, using a SQL query....
1
vote
2
answers
705
views
How to let Java library users choose between JSON parsing frameworks?
I am developing a Java library that can be used to call a certain web API that is using JSON data format to pass information. Said library will only contain data classes according to the data ...
0
votes
1
answer
492
views
How to configure Json-B in RestEasy Client?
I use the RestEasy client. In the processed json object there is a base64 encoded byte array. However, the Yasson library assumes an int-coded array in the unconfigured case. How I tell the JsonConfig ...
0
votes
2
answers
2k
views
NoClassDefFoundError jakarta/json/bind/JsonbBuilder
I am having an error while trying to use Jsonb / JsonbBuilder in a JakartaEE maven project.
Error StackTrace
java.lang.RuntimeException: jakarta/json/bind/JsonbBuilder
at org.apache.tomcat....
4
votes
1
answer
417
views
Instead of @JsonbIgnore, is it possible to require explicit inclusion of an object's fields on jax-rs (jersey+moxy) JSON serialization?
I have a JPA entity implementing an interface and I want to expose via jax-rs endpoint only the fields that are defined by that interface. Something that looks like:
public interface ...
1
vote
1
answer
3k
views
Use Java records with JSON-B + Jax-RS
My project uses JSON-B with JAX-RS. The framework I am using is Quarkus and use Java 11. I tried to upgrade to Java 16 and use Java Records. It seems that JSON-B and Records does not work nicely.
I ...
1
vote
2
answers
375
views
How to include the fields of a Java enum in the resulting JSON representation with JSON-B?
Let's say I have the following Java enum:
@AllArgsConstructor
public enum Code {
Code1("Short text 1", "Long text 1"),
Code2("Short text 2", "Long text 2&...
1
vote
1
answer
709
views
JSONB applies minus one day on date
I'm trying to serialize a simple object with a date in JSON.
For that I'm using the JSONB library from Java EE.
I'd rather use a Date object than a simple String as I want the data to be strongly ...
0
votes
1
answer
154
views
Extract specific element from JSON using JSON-B
With Jackson we can extract specific element from JSON string and map it to relevant class, like below:
ObjectMapper mapper = new ObjectMapper();
JsonNode root = mapper.readTree(someJson);
JsonNode ...
0
votes
2
answers
107
views
Checking json fields using json-b api
I am using json binding API to parse json string for application deployed on Liberty application server.
Suppose I have json string as given below
String message = "{ "color" : "...
1
vote
1
answer
360
views
Migrating from Jackson to JSON-B
As we're moving from Payara 4 to Payara 5, which using JSON-B (implemented by Yasson) as default, we're trying to configure JSON-B to have the same behavior as Jackson, which we used in Payara 4.
With ...
1
vote
0
answers
166
views
Is there a Yasson/Json-b equivalent of JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY
I am converting a library from Jackson to json-b, but I cannot find the equivalent of JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY. Does such a thing exist?
I got the following to work, but I hate ...
1
vote
1
answer
274
views
How to deserialize unknown properties with JSON-B?
I'm trying to deserialize the following JSON (see API documentation) using the JSON-B implementation from Quarkus.
What bugs me here are the dynamically generated numeric keys for multiple JSON ...