This is the continuation of Ignore Unexpected XML with XStream. In the above code XStream parser declaration will ignore Unexpected XML. The below XStream parser declaration will be useful to Ignore Unexpected JSON.
XStream xstream = new XStream(new JettisonMappedXmlDriver()) { @Override protected MapperWrapper wrapMapper(MapperWrapper next) { return new MapperWrapper(next) { @Override public boolean shouldSerializeMember(Class definedIn, String fieldName) { if (definedIn == Object.class) { return false; } return super .shouldSerializeMember(definedIn, fieldName); } }; } };
new JettisonMappedXmlDriver() // this driver is for generating JSON
Everything is same as before article.
Good blog. Keep sharing. I love them Are you also searching for Cheap assignment writers? we are the best solution for you. We are best known for delivering writing services to students without having to break the bank
ReplyDelete