I am trying to make simple GET request using groovy HTTP request. I am expecting JSON response in this form: So far I have done this in my code: and I am always getting this response: I have googled and found out that it’s problem related to groovy and this problem was not occurring before version 2.3.0…
Tag: json
File structure listing as Json
How can I get a local directory listing as a Json? So If I provide a folder, I want to see all its subfolders and files in a json tree type object. Please note: I don’t want just the list with file paths. Thank you! Answer So @CommonsWare put me in the right direction and I was able to do
Jackson Serialize Field to Different Name
I have this JSON to deserialize: I want to serialize it to 2 different formats: [A] [B] I’m able to serialize it to 1 format: [A] only or [B] only. Here’s my code to serialize it to [B]: I read about JsonView here http://www.baeldung.com/jackson-json-view-annotation (section ‘5. Customize JS…
How can I prevent gson from converting integers to doubles
I’ve got integers in my json, and I do not want gson to convert them to doubles. The following does not work: The output is not what I want: Is there a way to have Integers instead of Doubles in my Map? Edit: not all my fields are integer. I’ve modified my example accordingly. I’ve read quit…
How to serialize nested ObjectId to String with Jackson?
There are many questions concerning conversion from ObjectId to String with jackson. All answers suggest either creating own JsonSerializer<ObjectId> or annotating the ObjectId field with @JsonSerialize(using = ToStringSerializer.class). However, I have a map that sometimes contains ObjectIds, i.e.: I w…
Using spring converter in @RequestBody
Is it possible to enforce Converter ( org.springframework.core.convert.converter.Converter) to finish json object mapping? Json code example: where somename – string, id – integer value mapping to : Converter code example: What I want to achieve is to map that json to the object which will have au…
UnrecognizedPropertyException: Unrecognized field not marked as ignorable at Source: org.apache.catalina.connector.CoyoteInputStream@14ec141
I am making rest web-services my code is: but when i call it with this Json : I’m getting following Exception: javax.servlet.ServletException: org.codehaus.jackson.map.exc.UnrecognizedPropertyException: Unrecognized field “userId” (Class com.tazligen.model.GroupMemberMap), not marked as igno…
Calling Struts 2 action class from AngularJS with HTTP GET request but not getting any response
I am creating a simple application, that make a simple call to action of Struts 2 via AngularJS. I just create a simple HTTP GET request from AngularJS to get JSON from the server. At server end I am using Struts2 action class named as AngularAction.java. But, all the time I am unable to hit the class, even I…
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…
Mapping java.lang.String type to Postgres JSON Type
My question is related to the following question Mapping postgreSQL JSON column to Hibernate value type and although the answer works when I test passing a string to psql in postgres it doesn’t work when passing a string from my Java code. I am using MyBatis to map sql to the postgres database via Sprin…