Questions tagged [fasterxml]
FasterXML is an open source XML and JSON parsing for the Java platform
493
questions
0
votes
1
answer
23
views
How to clone a json content with some modifications using jackson fasterxml
Suppose we create a json as a string constructed like this;
StringWriter writer = new StringWriter();
final JsonGenerator json = mapper.getFactory().createJsonGenerator(writer);
// construct the ...
0
votes
2
answers
46
views
customized JSON parser with equal sign
I'm using fasterxml java library to parse json data, some of the data is using = instead of : as the key value seperator, e.g. {"key"="foo", "size"=123}, is there a way ...
1
vote
1
answer
328
views
fasterxml jackson databind upgrade to 2.15.2
I am trying to upgrade our fasterxml jackson databind from version 2.9.3 to 2.15.2.
But i am getting following runtime error, Build was successful.
Springboot version - 2.2.6
Article i used for ...
0
votes
0
answers
68
views
ObjectMapper Custom serializer for serializing a List<User> to User object
I've below Group and User Model objects
public class Group {
List<User> user;
}
public class User {
String title;
}
I'm using Jackson to ...
0
votes
0
answers
15
views
How to configure fasterxml's objectMapper to handle empty string "" correctly
I'm using fasterxml's ObjectMapper to serialize a java object and I'm having a problem with one of the fields.
Survey.java
public class Survey {
private String id;
private String answers;
//...
0
votes
0
answers
24
views
Serialize nullalbe value with ZonedDateTimeSerializer
I have a nullable ZonedDateTime value that should be serialized to JSON using com.fasterxml.jackson.
I am currently doing it like so:
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = ...
0
votes
0
answers
57
views
Stream ingestion Kafka to Pinot error invalid utf-8 start byte
Pinot version: 0.12.1
Java JDK: 11
I tried to ingestion data realtime from kafka to pinot with 2 cases:
Case 1: It work like charm
{"event":{"header": "v1","body&...
0
votes
0
answers
7
views
How to I add a springframework/fasterxml hook for pre/post JSON serialisation?
I have a JPA entity A that I want to serialize into JSON using springframework annotations.
The entity has a (non identifying) foreign key, so in the JPA, this is an object B.
I want our angular ...
0
votes
2
answers
506
views
limit the size of the string value of all keys with Jackson
I have a dynamic nested json string and I wanted to limit the string value of all keys to have max length of 5 chars.
Using: Java fasterxml.jackson
For Json String like below:
String inputJsonString = ...
0
votes
0
answers
140
views
Reading com.fasterxml.jackson.core from resteasy-jackson-provider 3.9.0
we are using Resteasy 3.9.0.Final in our vanilla java project. I have an api method which reads a POJO(Request) written in Jackson com.fasterxml.jackson.core:jackson-annotations:2.10.0.
@Override
...
0
votes
1
answer
55
views
Alternate FasterXML TypeReference that formats better with default Intellij Formatter?
When you are doing a ObjectMapper.readValue on type with Generic parameters, you use this:
new ObjectMapper().readValue(someSourceValue, new TypeReference<Map<String, Object>>() {});
and ...
0
votes
1
answer
107
views
How to use an interface type instead of Object? Converting problem
I want to use Event interface type for eventData field in EventDto class.
I also have impl of Event its PrintEvent.
Before that I used Object instead of Event for eventData field and everything worked ...
1
vote
1
answer
181
views
failed to parse xml: Unrecognized property 'com.ctc.wstx.maxEntityCount'
I'm using 'com.fasterxml.woodstox:woodstox-core:6.5.0' dependency to work with XMLInputFactory via WstxInputFactory In a gradle project. When I try to run the below code,
xmlInputFactory = ...
-1
votes
1
answer
311
views
com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "field" (class com.mapper.example.Parent)
I got a deserialization problem:
Trying to convert class which extends parent class. Please find my class below,
public class Base {
Parent parent;
public Parent getParent() {
return ...
0
votes
1
answer
331
views
JavaPropsMapper in com.fasterxml.jackson version 2.14.2
I did an upgrade of com.fasterxml.jackson from 2.8.8 to 2.14.2 but I noticed that the following code will not work in version 2.14.2 :
//where javaPropsMapper is an instance of com.fasterxml.jackson....
0
votes
0
answers
156
views
jackson convert a map to list of object
I have the below Sinister entity
@Document
@Getter
@Setter
@ToString
@AllArgsConstructor
@NoArgsConstructor
@Builder(toBuilder = true)
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class Sinister ...
0
votes
0
answers
237
views
Weblogic 12.2.1.4.0 use Jackson Fasterxml instead of Codehaus Jackson
Our applications will be deployed on Weblogic Servers Version 12.2.1.4.0. We removed the usage of codehaus jackson completely from our code and want to use jackson fasterxml in version 2.13.2 instead. ...
2
votes
1
answer
146
views
Fasterxml json null to "null"
I have class
@Data
class Person {
@JsonProperty(value="name", defaultValue = "null")
private String name = "null";
@JsonProperty(value="surName", ...
0
votes
0
answers
26
views
jackson fasterxml multiple elements with the same name not aligned together [duplicate]
<A>
<Ser name="cluster1" localroot="search" branch="feature>
</Ser>
<PR localroot="search" msg="Merge the ...
1
vote
0
answers
44
views
Jackson ObjectMapper setVisibility Warnings, Pros and Cons?
I'd like to keep implemenetations functionalities non-intrusive. Having said that, getters for private fields just to allow objectMapper to ser/deserialize objects bothered me quite a long time. So I ...
0
votes
0
answers
41
views
Java: how to deserialise and transform name strategy for complex Map
I have a map with dynamic structure Map<String, Object>, where value - Object can be number, string or another Map<String, Object>
I need to transform all keys name strategy from ...
0
votes
0
answers
279
views
java.lang.NoSuchMethodError: com.amazonaws.transform.JsonUnmarshallerContext.getCurrentToken()Lshaded/com/fasterxml/jackson/core/JsonToken;
I'm currently getting this error:
java.lang.NoSuchMethodError: com.amazonaws.transform.JsonUnmarshallerContext.getCurrentToken()Lshaded/com/fasterxml/jackson/core/JsonToken;
It looks like there's a ...
0
votes
1
answer
1k
views
Getting issue with elastic search java client - Caused by: java.lang.NoClassDefFoundError: co/elastic/clients/json/JsonpMapper
pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 ...
2
votes
1
answer
1k
views
cannot access javax.ws.rs.ext.MessageBodyReader while using JacksonJsonProvider.setMapper
Im facing cannot access javax.ws.rs.ext.MessageBodyReader while upgrading to spring 6.
Im using glassfish jersey 3.1.0 for REST services in spring 6 application and com.fasterxml.jackson.jaxrs.jackson-...
0
votes
1
answer
67
views
JacksonXML: Resolve inconventional json field name without annotation
I have a java project where one of my packages contain a lot of dataclasses. These classes are used with deserialization. Currently the package depends on fasterXML only because one of my classes has ...
0
votes
0
answers
59
views
jackson-databind Java7SupportImpl problem on jdk11 and aws-sdk
I'm migrating a spring boot app from jdk8 to jdk11, along with spring boot to 2.7.7.
I am getting this runtime error post a successful compile.
jackson-databind resolved to the one sourced by spring ...
0
votes
1
answer
137
views
How do I remove a wrapper for an object when using XmlWrapper?
The XML output contains the wrapper "credentials" altough I excluded it with defaultUseWrapper(false).
UserDAO
public class UserDAO {
@JacksonXmlProperty(isAttribute = true)
private ...
0
votes
0
answers
80
views
@JsonSubTypes with Generic classes which are in other projects
I have a JSON structure with an Interface "ActionInterface".
This "ActionInterface" is used for different types of Actions (sendEmail, deleteUser...).
I have different kind of ...
1
vote
2
answers
48
views
No insertion orderr is preserved while converting from xml to json using org.json.XML.toJSONObject(xmlStirng)
I am using a dynamic data structure for my project. So instead of a predefined class I am using java.util.LinkedHashMap to store my dynamic data and preserve my insertion order as well.
I am able to ...
0
votes
1
answer
209
views
Jackson ObjectMapper.readValue throws NullPointerException, LRUMap.get(LRUMap.java:68)
I write a hive UDF which looks like below:
public class DemoUDF extends GenericUDF{
private ObjectMapper mapper = new ObjectMapper();
... initialize() method...
public Object ...
0
votes
1
answer
207
views
In fasterxml's JsonParser I want to get the raw text from property
I have a sample snippet that parses the JSON that I am trying to get the rawtext of the value. I want to properly escape the text for XML.
package org.example;
import com.fasterxml.jackson.core....
-1
votes
1
answer
748
views
Ignore property when converting object to json string but not when converting string to Object using by Jackson library [duplicate]
I have a REST API that provides me a JSON. In the json I receive from the REST API, there is a ID property I want to read so I can do some checking on it. However, when I want to write back to the web ...
0
votes
0
answers
201
views
Jackson deserialization : Unrecognized field
I'm trying to deserialize a JSON but I still get the same UnrecognizedPropertyException even though the Object has all the properties needed for the process of deserialization, at least I think!
The ...
2
votes
0
answers
299
views
Problems while updating Fasterxml jackson databind to version 2.14.0-rc1
There are vulnerabilities in fasterXML jackson-databind version I am currently using, Vulnerabilities are : CVE - 2022-42003, CVE - 2022-42004
I searched on intelliJ and codebase, changed version in ...
1
vote
1
answer
1k
views
InvalidFormatException when deserializing String to BigDecimal
Trying to deserialize a String to BigDecimal with a different format. The standard format, e.g. "1,000.20" works. However, in my csv the decimal delimiter and group separator are the other ...
2
votes
1
answer
96
views
jooq deserialize a polymorphic class
I am using JOOQ to manipulate the database,now i have a problem.
There is a polymorphic class OrderEntry
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property ...
0
votes
1
answer
1k
views
Not able to register JavaTimeModule
I have a spring boot application with version 2.7.3.
I have a util class, that creates a new Object mapper and registers the Javatimemodule class to that.
So in the test case, I try to verify that the ...
2
votes
0
answers
473
views
Spring Boot MessageConverter using JakartaXmlBindAnnotationModule cannot resolve individual @XMLElements property names
Using the following configuration with a Spring Boot Application only partially unmarshals XML.
@Configuration
class WebConfig implements WebMvcConfigurer {
@Override
public void ...
0
votes
1
answer
126
views
Mapping xml attributes to java attributes
Is there a way to map xml attributes to Java attributes using Jackson Faster xml.
Sample xml
<student>
<details>
<element key="firstName" value="John" />
<...
-1
votes
1
answer
565
views
Best way to validate json file in java
I want to validate the JSON file. I checked readValue from fasterXML but I see it return object. Is there any to validate JSON files efficiently without compromising performance?
public <T> T ...
0
votes
0
answers
993
views
Nested JSON to Kotlin Data Class
I have Kotlin data classes Things and Thing
data class Things(val things: List<Thing>,
val owner: String,
val count: Int)
and
data class Thing(val name: ...
2
votes
4
answers
362
views
How to map a JSON string which includes members named long and short
I need to map a JSON string which includes values named long and short:
"status": {
"long": "Finished",
"short": "F",
"elapsed": 90
...
0
votes
1
answer
73
views
FasterXML ObjectMapper is not working with ExecutorService in a Junit test
It is a very strange issue. Removing the JSON in TestUtil or the executorService/submit will make the following code working:
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api....
2
votes
1
answer
824
views
Why I get error parsing JSON when get from Feign?
Here is my JSON I'm returning from my STUB:
{
"brokerAccounts": [
{
"id": "4598",
"customTags": [
"main-buy"
]
...
0
votes
1
answer
328
views
How to manipulate a yaml using fasterxml without adding default value of field's
I am currently using faster xml's to convert a yaml to java object, change it and convert it back to yaml.
However I see that when I read the yaml, all the fields are getting populated with these ...
0
votes
0
answers
393
views
How to create case insensitive CsvSchema ising jackson?
I have the following CSV file:
field_1,field_2
123, ewfwe
.....
Lets take a look at the following code:
CsvSchema schema = CsvSchema.emptySchema()
.withUseHeader(true)
....
1
vote
0
answers
840
views
How to read CSV without header and unknown amount of columns?
I have a class which parses CSV file.
This CSV file doesn't have header. Also it mus contain only 1 column.
I want to add validation for columns count.
My current code is:
CsvSchema csvSchema = ...
2
votes
0
answers
5k
views
Warning on Illegal reflective access by com.fasterxml.jackson.databind.util.ClassUtil
I am getting the below warning intermittently while running my java application,
WARNING: All illegal access operations will be denied in a future release
WARNING: An illegal reflective access ...
0
votes
0
answers
388
views
Create new json file using json template file
I have a json template file. Using java program, I need to read the template and create a new json file with updated values.
Example Template json example:
{
"page": 2,
"...
0
votes
2
answers
2k
views
Scala module 2.8.11 requires Jackson Databind version >= 2.8.0 and < 2.9.0
I'm using Scala 2.11 and Spark 2.4.3 for our AWS glue jobs. Recently, I got the error message below in our the build pipeline.
Cause: com.fasterxml.jackson.databind.JsonMappingException: Scala module ...