I have issue while using ObjectMapper with YAMLFactory to Parse a YAML File

 

1.       The YAML file I’m trying to parse 
: https://drive.google.com/open?id=1Q85OmjH-IAIkordikLTsC1oQVTg8ggc8

2.       Parsing the File using readValue as shown here :

 

ObjectMapper mapper = *new* ObjectMapper(*new* YAMLFactory().enable(Feature.
*MINIMIZE_QUOTES*)//

                .disable(Feature.*WRITE_DOC_START_MARKER*)//

                .disable(YAMLGenerator.Feature.*SPLIT_LINES*));

// mapper.getFactory().setCharacterEscapes(new YAMLCharacterEscapes());

TypeReference<HashMap<String, Object>> typeRef = *new* 
TypeReference<HashMap<String, 
Object>>() {};

HashMap<String, Object> obj = mapper.readValue(responseBuffer.toString(), 
typeRef);

 

3.       Converting the Obj to json then to YAML again by :

 

JsonElement jsonElem = *wrapJacksonObject*(obj);

        String cloudTemplateJsonString = *new*
 GsonBuilder().disableHtmlEscaping().setPrettyPrinting()//

                .create()//

                .toJson(jsonElem);

 

        JsonNode jsonNode = mapper.readTree(cloudTemplateJsonString);

        String yaml = *new* YAMLMapper().enable(Feature.*MINIMIZE_QUOTES*)//

                .disable(Feature.*WRITE_DOC_START_MARKER*)//

                .writeValueAsString(jsonNode);

 

4.       After checking the last String, I see that these Special 
Characters are Changed/Deleted (they are Changed exactly after Point 2) :

 

a.       ‘ transferred to “ or Deleted

b.       ! : Regarding the exclamation mark : the whole string after it 
until first space is deleted totally :

 

Diff Examples on what I talking about :

 

5.       I try to use Escape Characters Customization By customizing 
Implementation for *CharacterEscapes* class but it didn’t help

 

Do you have any suggestions ? Please help me I really need your help to 
success my project

-- 
You received this message because you are subscribed to the Google Groups 
"jackson-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jackson-user/e9178bb1-27eb-43e7-a334-658702dafb62%40googlegroups.com.

Reply via email to