Hi,

I have requirement to get root element from JSON document which I use for 
other manipulations. My applications have different apis(heterogeinus) some 
includes root element and some do not include root element in the JSON 
payload. 
SO I need to inspect the payload and check if it has root element, then 
plan to set
           
jacksonObjectMapper.enable(DeserializationFeature.UNWRAP_ROOT_VALUE);

for e.g; 
JavaType javaType = getJavaType(type, contextClass);
        Annotation rootAnnotation = 
javaType.getRawClass().getAnnotation(JsonRootName.class);
if(rootAnnotation != null){
            
this.getObjectMapper().enable(DeserializationFeature.UNWRAP_ROOT_VALUE);
        }
        
The problem is, some of the JSON objects do not have JsonRoot annotation. 
So I am always getting the rootAnnotation as null though root element is 
included in the JSON payload.
Is there anyway to check dynamically, weather root element included in 
payload(generic way)?

Thanks,

-- 
You received this message because you are subscribed to the Google Groups 
"jackson-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to