java - Can not convert attribut "type" in xml string to json string by Restlet StringRepresentation class -
After converting, I came to know that everything is fine, besides the specialty "type" which is not in the result of the JSSN string. I know that "type" is a special name in many cases. Is there any configuration in the restlate, can I set the string repetition class to "type" as the normal attribute name? Answer this is the solution that you have set the Internet enabled (incorrect) in XMLSerializer. XMLSerializer filtered the attribute "type", not string presentation. Here's the code:
XMLSerializer serializer = new XMLSerializer (); Serializer.setTypeHintsEnabled (false); Results = New String Repection (serializer.read (xml) .toString (), MediaType .APPLICATION_JSON, Language.ALL, CharacterSAT.UTF_8);
Comments
Post a Comment