Tag: JSON
-
Jackson 2.x: JSON Serialization Difference for Map.Entry between 2.4.x vs 2.5.x
It appears Jackson 2.4.5 and 2.5.1 behave a little differently when handling Map.Entry. Let’s assume we have the following bean:- We have a simple Spring MVC rest controller that creates this bean and returns the JSON data back to the client:- Jackson 2.4.5 generates the following JSON:- Jackson 2.5.1 generates the following JSON:- Read More…
-
Spring MVC: Handling Joda Data Types as JSON
PROBLEM Let’s assume we have the following bean that contains Joda’s LocalDate and LocalDateTime objects:- This simple Spring MVC rest controller creates this bean and returns the JSON data back to the client:- By default, the generated JSON looks like this:- How do we nicely format these values and still retain the correct data types… Read More…
-
Managing the Order of AJAX Calls on Input Field’s Keyup Event
SCENARIO Consider the following code:- When user types an employee’s name, “Mike”, in the search field, a web service call is fired per character typed. In this example, the following web service calls are made:- Let’s assume this web service searches the input string against databases (or flat files, Facebook API, etc) and returns a… Read More…
-
Pretty Print JSON in JavaScript
PROBLEM You want to display a JSON object in JavaScript. TAKE 1 While this works, I find this approach inconvenient when viewing the output in Firebug because I have to click on each generated link to view the details. TAKE 2 … will generate this:- This approach will display the entire JSON object as one… Read More…