osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[jira] [Created] (FLINK-10280) json that contains an object can not be parse


sean.miao created FLINK-10280:
---------------------------------

             Summary: json that contains an object can not be parse
                 Key: FLINK-10280
                 URL: https://issues.apache.org/jira/browse/FLINK-10280
             Project: Flink
          Issue Type: Bug
          Components: Batch Connectors and Input/Output Formats
    Affects Versions: 1.6.0
            Reporter: sean.miao


data like :

{"key":"\{\"key\":1}"}

can be parsed correctly;

 

but data like :

{"key":\{"key":1}}

cannot be parsed correctly.

 

code position:

JsonRowDeserializationSchema#convert

else {
 // for types that were specified without JSON schema
 // e.g. POJOs
 try {
 return objectMapper.treeToValue(node, info.getTypeClass());
 } catch (JsonProcessingException e) {
 throw new IllegalStateException("Unsupported type information '" + info + "' for node: " + node);
 }
}

 

My solution is as follows:

else {
// for types that were specified without JSON schema
// e.g. POJOs
try {
return objectMapper.treeToValue(node, info.getTypeClass());
} catch (JsonProcessingException e) {

return node.toString
}
}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)