How to return a long property as JSON string value with JAXB
问题 I have a Java class annotated with @XmlRootElement . This Java class has a long property ( private long id ) that I want to return to a JavaScript-client. I create the JSON as follows: MyEntity myInstance = new MyEntity("Benny Neugebauer", 2517564202727464120); StringWriter writer = new StringWriter(); JSONConfiguration config = JSONConfiguration.natural().build(); Class[] types = {MyEntity.class}; JSONJAXBContext context = new JSONJAXBContext(config, types); JSONMarshaller marshaller =