String string= "{\" deviceno\ ": \" C:\\a\ "};
Mybean mybean= (Mybean) jsonmapper.getinstance (). Fromjson (String, Mybean. Class);
The error is as follows:
com.fasterxml.jackson.databind.JsonMappingException:Unrecognized character escape ' a ' (code 77)
At [source:java.io.stringreader@259f1b1d Line:1, column:734] (through reference chain: com.taiji.kafka2stormunite.util.kakouldvehiclepassentity["Imagedescriptions"])
At Com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath (jsonmappingexception.java:232)
At Com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath (jsonmappingexception.java:197)
At Com.fasterxml.jackson.databind.deser.BeanDeserializerBase.wrapAndThrow (beandeserializerbase.java:1311)
At Com.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeFromObject (beandeserializer.java:297)
At Com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize (beandeserializer.java:121)
At Com.fasterxml.jackson.databind.objectmapper._readmapandclose (objectmapper.java:2888)
At Com.fasterxml.jackson.databind.ObjectMapper.readValue (objectmapper.java:2034)
At Com.taiji.kafka2stormunite.util.JsonMapper.fromJson (jsonmapper.java:105)
At Com.taiji.kafka2stormunite.util.JsonMapper.main (jsonmapper.java:221)
caused by:com.fasterxml.jackson.core.JsonParseException:Unrecognized character escape ' M ' (code 77)
At [source:java.io.stringreader@259f1b1d Line:1, column:734]
At Com.fasterxml.jackson.core.jsonparser._constructerror (jsonparser.java:1369)
At Com.fasterxml.jackson.core.base.parserminimalbase._reporterror (parserminimalbase.java:532)
At Com.fasterxml.jackson.core.base.parserminimalbase._handleunrecognizedcharacterescape (ParserMinimalBase.java : 507)
At com.fasterxml.jackson.core.json.readerbasedjsonparser._decodeescaped (readerbasedjsonparser.java:1788)
At Com.fasterxml.jackson.core.json.readerbasedjsonparser._finishstring2 (readerbasedjsonparser.java:1535)
At Com.fasterxml.jackson.core.json.readerbasedjsonparser._finishstring (readerbasedjsonparser.java:1512)
At Com.fasterxml.jackson.core.json.ReaderBasedJsonParser.getText (readerbasedjsonparser.java:205)
At Com.fasterxml.jackson.databind.deser.std.UntypedObjectDeserializer.deserialize ( UNTYPEDOBJECTDESERIALIZER.JAVA:59)
At Com.fasterxml.jackson.databind.deser.std.UntypedObjectDeserializer.mapObject (Untypedobjectdeserializer.java : 211)
At Com.fasterxml.jackson.databind.deser.std.UntypedObjectDeserializer.deserialize ( UNTYPEDOBJECTDESERIALIZER.JAVA:51)
At Com.fasterxml.jackson.databind.deser.std.UntypedObjectDeserializer.mapObject (Untypedobjectdeserializer.java : 225)
At Com.fasterxml.jackson.databind.deser.std.UntypedObjectDeserializer.deserialize ( UNTYPEDOBJECTDESERIALIZER.JAVA:51)
At Com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize (collectiondeserializer.java:230)
At Com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize (collectiondeserializer.java:207)
At Com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize (collectiondeserializer.java:1)
At Com.fasterxml.jackson.databind.deser.SettableBeanProperty.deserialize (settablebeanproperty.java:464)
At Com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet (methodproperty.java:98)
At Com.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeFromObject (beandeserializer.java:295)
... 5 more
Interrupted point of view, take value when only take the C:, visible encountered backslash terminated to the character fill to value, the following cannot parse the error.
Com.fasterxml.jackson.core.JsonParser This class sets the JSON parsing property.
/**
* Feature that can is enabled to accept quoting of all character
* Using backslash qooting mechanism:if not enabled, only characters
* that are explicitly listed by JSON specification can is thus
* Escaped (you'll have a JSON spec for small list of characters)
*<p>
* Since JSON specification requires quoting for ' all ' control characters,
* This is a non-standard feature, and as such disabled by default.
*/
Allow_backslash_escaping_any_character (False),
Allow all characters in quotation marks to be accepted, false by default
Set to True to solve the problem.