Blog Archive for April 10, 2018

JSON to XML with Jackson

April 10, 2018

I wanted to take an arbitrary JSON string and turn it into the equivalent XML. This can be done using the Jackson library.

String jsonString = "" 
        + "{\n \"_links\": {\n" 
        + "    \"individual\": {\n" 
        + "      \"href\": \"/individuals/matching\",\n" 
        + "      \"name\": \"GET\",\n" 
        + "      \"title\": \"Individual Details\"\n" 
        + " …

Java Enums with String values

April 10, 2018

I wanted to create an enum in Java 8 which was a set list of strings that can limit the values an attribute can hold. This can be done with:

public enum Systems {
  REGISTER("register"),
  PRINT("print"),
  MANAGEMENT("management"),
  ;

  private final String …