Skip to content

Tag: jackson

Jackson deserialization issue for ZonedDateTime

I’ve the following field in a class I use during deserialization of a service that I’m consuming. The service I’m consuming may return a Date or DateTime using the pattern: yyyy-MM-dd’T’HH:mm:ss.SSSZ Let me give 2 examples of what the service returns: 2015-11-18T18:05:38.000+0200…

Logging JSON-RPC calls using jsonrpc4j

I’m sure that if you have used jsonrpc4j (outside a spring container) you will recognise the following standard pattern. I am trying to create a log file containing all the JSON requests and JSON responses. i.e. I’d like to log the incoming JSON RPC request before it is deserialised and log the ou…

Check if JSON is valid in JAVA using Jackson

I have a JSON string which I am storing it in DB as a string. In front-end, I am rendering this JSON as object. I am using: String : Is there any way I can check If JSON is valid or not in JAVA? One thing to be noted here is that, I don’t have a schema defined for JSON

Java 8 LocalDate Jackson format

For java.util.Date when I do then in JSON request when I send it works. How should I do this for Java 8’s LocalDate field?? I tried having It didn’t work. Can someone please let me know what’s the right way to do this.. Below are dependencies Answer I was never able to get this to work simpl…

JSONPath resolver for Java objects

How can I get a value from an Java object instead from a JSON string by applying a JSONPath expression? I receive a Java object that is created from a JSON string (via Jackson, no way to influence it): I further have some JSONPath expressions as Java Strings reflecting values in the object (they might be much…

JSON object from java ObjectName.toString

I have a java object witch generates this output when i type objectName.toString() : Is there a JSON parser that lets me make a JSON from the string that my object generates? something like: JsonObject x = new JsonObject(busObject.toString()) It is important for me to generate it from the string that i get wh…