Questions tagged [fasterxml]

FasterXML is an open source XML and JSON parsing for the Java platform

489 questions
57
votes
4 answers

Generate JSON schema from Java class

I have a POJO class: public class Stock { int id; String name; Date date; } Are there any annotations or development framework/API that can convert POJO to JSON schema like below: {"id": { "type" : "int" …
user3587174
  • 661
  • 3
  • 8
  • 13
40
votes
5 answers

Could not read JSON: Can not deserialize instance of hello.Country[] out of START_OBJECT token

I have rest url that gives me all countries - http://api.geonames.org/countryInfoJSON?username=volodiaL. I use RestTemplate from spring 3 to parse returned json into java objects: RestTemplate restTemplate = new RestTemplate(); Country[] countries =…
Volodymyr Levytskyi
  • 3,364
  • 9
  • 46
  • 83
33
votes
3 answers

Create Java 8 Stream from ArrayNode

Is it possible to create stream from com.fasterxml.jackson.databind.node.ArrayNode? I tried: ArrayNode files = (ArrayNode) json.get("files"); Stream stream = Stream.of(files); But it will actually give stream of one element, the initial…
icl7126
  • 5,740
  • 4
  • 53
  • 51
31
votes
3 answers

Spring 4.2.3 and fasterxml Jackson 2.7.0 are incompatible

After migration from fasterxml.jackson 2.6.3 to 2.7.0. This is because public JavaType constructType(Type type, Class contextType) method used in Spring's AbstractJackson2HttpMessageConverter was removed. How to fix this? I am using Spring…
Marek Raki
  • 3,056
  • 3
  • 27
  • 50
30
votes
7 answers

JSON Serializing date in a custom format (Can not construct instance of java.util.Date from String value)

could not read JSON: Can not construct instance of java.util.Date from String value '2012-07-21 12:11:12': not a valid representation("yyyy-MM-dd'T'HH:mm:ss.SSSZ", "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", "EEE, dd MMM yyyy HH:mm:ss zzz",…
user739115
  • 1,117
  • 5
  • 20
  • 41
23
votes
2 answers

How can I Serialize/De-serialize a Boolean Value from FasterXML\Jackson as an Int?

I'm writing a JSON Client for a Server that returns Boolean values as "0" and "1". When I try to run my JSON Client I currently get the following Exception: HttpMessageNotReadableException: Could not read JSON: Can not construct instance of…
Raystorm
  • 6,180
  • 4
  • 35
  • 62
22
votes
3 answers

FasterXML jackson-dataformat-xml serialization version and encoding not added to xml

Hi I am serializing java POJO object to xml using faster-xml(https://github.com/FasterXML/jackson-dataformat-xml/wiki ).When i do that i got xml but it doesn't have any version and encoding in xml file.This is the format i need
Sajith Vijesekara
  • 1,324
  • 2
  • 17
  • 52
18
votes
2 answers

java.lang.ClassNotFoundException / NoClassDefFoundError for com/fasterxml/jackson/databind/ObjectMapper with Maven

I get the following error when trying to run a java program that uses jackon's ObjectMapper class: Exception in thread "main" java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/ObjectMapper at…
ur-vogel
  • 414
  • 1
  • 5
  • 11
17
votes
1 answer

How to deserialize XML with annotations using FasterXML

I have the following XML schema: Intermediate A Intro to A Advanced B I need to…
sbenderli
  • 3,654
  • 9
  • 35
  • 48
16
votes
1 answer

Jackson Converting String to Object

Link.java @JsonInclude(JsonInclude.Include.NON_NULL) @JsonPropertyOrder({ "rel", "href","method" }) public class Link { @JsonProperty("rel") private String rel; @JsonProperty("href") private String href; @JsonProperty("method") …
ytibrewala
  • 957
  • 1
  • 8
  • 12
14
votes
2 answers

NoClassDefFoundError of com/fasterxml/jackson/databind/ObjectMapper with Maven

This is a similar question as the one here, which is unfortunately unresolved yet. If you want to debug the code, here is the GitHub repo. I got the following NoClassDefFoundError for ObjectMapper though I have added the related dependency to Mave…
hackjutsu
  • 8,336
  • 13
  • 47
  • 87
14
votes
2 answers

fasterxml serialize using toString and deserialize using String constructor

I have a POJO which looks something like this: public class Thing { private final int x; private final int y; private final int z; public Thing(String strThing) { // parse strThing which is in some arbitrary format to set x, y…
PaddyD
  • 1,097
  • 1
  • 9
  • 19
13
votes
1 answer

Customizing enum constant names with Jackson

I have an enum defined as public enum Locale { EN_US, ES_MX } These locale, however, are written as lowercase strings with hyphen as en-us and es-mx in data. Is there a way to map these lowercase strings to corresponding enum constants? Like…
Nik
  • 5,515
  • 14
  • 49
  • 75
13
votes
4 answers

jackson serialize csv property order

we have a table with 350+ columns. pojo class is generated and getters order get messed up. trying to use csvmapper from jackson, but it generates csv based on getter order. @JsonPropertyOrder is also not use feasible because of many columns.we…
user2598799
  • 141
  • 1
  • 1
  • 7
12
votes
5 answers

Error during Deserialization of PageImpl : Cannot construct instance of `org.springframework.data.domain.PageImpl`

Issue is when using Spring cache with redis cache manager, not able to deserializer Spring Pageable response due to no default constructor The spring boot version used is 2.1.4.RELEASE Redis config class that uses the serializer @Bean public…
1
2 3
32 33