Questions tagged [jaxb]

Java XML Structure Binding is the preferred method in Java for handling XML within domain objects. This technology offers a simple way to associate Java classes with corresponding XML structures.

Structure of JSON for a Collection of Items

I'm curious about the correct JSON structure for a list of objects. In our project, we are using JAXB to convert POJOs to JSON. Here are the options. Can you please advise on the right approach? foos: [ foo:{..}, foo:{..} ...

When working with Java, it is important to remember that a JSONObject text always needs to start with a '{' at the first character

I've been struggling to troubleshoot a JAXB JSON issue, but I can't seem to pinpoint the source of the problem. The error message I'm receiving states: Caused by: org.codehaus.jettison.json.JSONException: A JSONObject text must begin with '{' at character ...

What is the process for setting Glassfish 5 to utilize Moxy as the primary Provider?

As we transition our web application from Glassfish 3 to Glassfish 5, an error appeared during the migration process for a particular request. [2019-09-17T15:57:30.732-0600] [glassfish 5.0] [WARNING] [] [javax.enterprise.web] [tid: _ThreadID=241 _ThreadNa ...

An issue occurred when trying to retrieve JSON data using JAXB, but the data can be easily obtained in XML format

package com.marketplace.acres.dummyapp.test; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.xml.bind.annotation.XmlRootElement; @Path("/fortest") @XmlRootElement public class ...

Exploring the differences between conditional serialization using JAXB and Jackson: An insight into External and Internal Views

As I develop a RESTful API, I encounter a scenario where I must present two different perspectives of my data - one for internal use and another for external exposure. Furthermore, my API should accommodate both XML and JSON formats. In the case of JSON r ...

An array containing multiple arrays in JSon format

I am currently working on creating a JSon document along with its corresponding xsd file to generate JAXB classes, and I'm not entirely sure if I am doing it correctly. The structure I aim to achieve is as follows: team -name="name" -game="game" ...

Changing LinkedHashMap<String,String> into an object in Java

Let's dive straight into my inquiry and delve deeper into the context later. Specific Question: I have a LinkedHashMap<String, String> representing a specific object. What is the most efficient way to convert it into that object? I am aware th ...