public void testJSONOutputStreamUTF8() throws Exception { marshaller.setProperty(MarshallerProperties.MEDIA_TYPE, "application/json"); unmarshaller.setProperty(UnmarshallerProperties.MEDIA_TYPE, "application/json"); FlushRoot control = getControlObject(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); marshaller.marshal(control, baos); XMLInputFactory xif = XMLInputFactory.newFactory(); Object test = unmarshaller.unmarshal(new ByteArrayInputStream(baos.toByteArray())); assertEquals(control, test); }