title: "Content is not allowed in prolog" When Unmarshalling JSON using JAXB
body: <p>I'm trying to unmarshal some JSON using JAXB &amp; the following test:</p>
  
  <pre><code>private static final String json = "{\"displayName\":\"2 KB\",\"externalId\":\"e1bc7db1-e7d5-41c9-8d2a-681f64ffea77\",\"contentType\":\"image/jpeg\",\"created\":\"2014-04-04T10:42:57\",\"lastModified\":\"2014-04-04T10:42:57\",\"originalFilename\":\"pgtips.jpg\",\"size\":\"2902\",\"tags\":\"\"}";
  
  @Test
  public void testDocStoreResponse() throws Exception {
    JAXBContext context = JAXBContext.newInstance(JAXBFile.class);
    Unmarshaller unmarshaller = context.createUnmarshaller();
    StringReader reader = new StringReader(json);
    unmarshaller.unmarshal(reader);
  }
  </code></pre>
  
  <p>JAXBFile is a simple POJO representing the JSON:</p>
  
  <pre><code>@XmlRootElement
  public class JAXBFile extends AbstractBean implements IFile {
    private String originalFilename;
    private Date created;
    private Date lastModified;
    private String tags = "";
    private String contentType;
    private long size;
  
    // Un-annotated getters &amp; setters follow
  }
  </code></pre>
  
  <p>But whenever I run it, I get a stacktrace starting with:</p>
  
  <pre><code>javax.xml.bind.UnmarshalException
   - with linked exception:
  [org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.]
  at javax.xml.bind.helpers.AbstractUnmarshallerImpl.createUnmarshalException(Unknown Source)
  at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.createUnmarshalException(UnmarshallerImpl.java:578)
  </code></pre>
  
  <p>This used to be working so I've changed something but I have no idea what. Does anyone have any clues on what might be causing the problem? From a bit of debugging the classes in the stacktrace, it appears like the JSON is being parsed as if it's XML but I'm unsure why. Dependencies etc. seem to be fine.</p>