All Questions

Tagged with
Filter by
Sorted by
Tagged with
1241votes
36answers
2.1mviews

How to parse JSON in Java

I have the following JSON text. How can I parse it to get the values of pageName, pagePic, post_id, etc.? { "pageInfo": { "pageName": "abc", ...
user avatar
961votes
9answers
841kviews

How to use Jackson to deserialise an array of objects

The Jackson data binding documentation indicates that Jackson supports deserialising "Arrays of all supported types" but I can't figure out the exact syntax for this. For a single object I would do ...
user avatar
848votes
45answers
1.0mviews

Jackson with JSON: Unrecognized field, not marked as ignorable

I need to convert a certain JSON string to a Java object. I am using Jackson for JSON handling. I have no control over the input JSON (I read from a web service). This is my input JSON: {"wrapper":[{"...
user avatar
  • 8,561
691votes
12answers
592kviews

Ignoring new fields on JSON objects using Jackson [duplicate]

I'm using Jackson JSON library to convert some JSON objects to POJO classes on an android application. The problem is, the JSON objects might change and have new fields added while the application is ...
user avatar
502votes
28answers
376kviews

Infinite Recursion with Jackson JSON and Hibernate JPA issue

When trying to convert a JPA object that has a bi-directional association into JSON, I keep getting org.codehaus.jackson.map.JsonMappingException: Infinite recursion (StackOverflowError) All I found ...
user avatar
  • 9,119
497votes
20answers
1.8mviews

How to convert jsonString to JSONObject in Java

I have String variable called jsonString: {"phonetype":"N95","cat":"WP"} Now I want to convert it into JSON Object. I searched more on Google but didn't get ...
user avatar
492votes
15answers
379kviews

Deserialize a List<T> object with Gson?

I want to transfer a list object via Google Gson, but I don't know how to deserialize generic types. What I tried after looking at this (BalusC's answer): MyClass mc = new Gson().fromJson(result, new ...
user avatar
  • 7,498
460votes
14answers
459kviews

JsonMappingException: No suitable constructor found for type [simple type, class ]: can not instantiate from JSON object

I am getting the following error when trying to get a JSON request and process it: org.codehaus.jackson.map.JsonMappingException: No suitable constructor found for type [simple type, class com....
user avatar
  • 12.3k
441votes
16answers
353kviews

Gson: How to exclude specific fields from Serialization without annotations

I'm trying to learn Gson and I'm struggling with field exclusion. Here are my classes public class Student { private Long id; private String firstName = "...
user avatar
  • 23.4k
430votes
6answers
184kviews

Should I declare Jackson's ObjectMapper as a static field?

The Jackson library's ObjectMapper class seems to be thread safe. Does this mean that I should declare my ObjectMapper as a static field like this class Me { private static final ObjectMapper ...
user avatar
403votes
8answers
402kviews

Only using @JsonIgnore during serialization, but not deserialization

I have a user object that is sent to and from the server. When I send out the user object, I don't want to send the hashed password to the client. So, I added @JsonIgnore on the password property, but ...
user avatar
  • 35.9k
389votes
5answers
187kviews

Jackson Vs. Gson [closed]

After searching through some existing libraries for JSON, I have finally ended up with these two: Jackson Google GSon I am a bit partial towards GSON, but word on the net is that GSon suffers from a ...
user avatar
379votes
16answers
707kviews

How to iterate over a JSONObject?

I use a JSON library called JSONObject (I don't mind switching if I need to). I know how to iterate over JSONArrays, but when I parse JSON data from Facebook I don't get an array, only a JSONObject, ...
user avatar
348votes
29answers
873kviews

How to convert hashmap to JSON object in Java

How to convert or cast hashmap to JSON object in Java, and again convert JSON object to JSON string?
user avatar
  • 12.4k
327votes
20answers
412kviews

Serializing with Jackson (JSON) - getting "No serializer found"?

I get the an exception when trying to serialize a very simple object using Jackson. The error: org.codehaus.jackson.map.JsonMappingException: No serializer found for class MyPackage.TestA and no ...
user avatar
  • 18.8k

15 30 50 per page
1
2 3 4 5
2530