Forum Discussion
5 Replies
- dmillerFormer Employee
Did you ever figure out the issue?
Bumping up if not since there were no comments yet. - robinFormer Employee
I helped out on this one. Yes, I believe the root cause was successfully identified.
A custom object was being used directly as the Document data and hence this behavior was experienced.
To ensure compatibility, an instance of SnapLogic’s Jackson
ObjectMapper
can be injected and then used to create a JSON-compatible version of your custom object:@Inject private ObjectMapper mapper;
Instead of:
outputViews.write(documentUtility.newDocument(edi835Message));
do this:
outputViews.write(documentUtility.newDocument(mapper.convertValue(edi835Messsage, Map.class));
This ensures that the Document written to the output view contains a Map, which the Mapper will then be able to introspect and display in its input schema.
- ryagnikNew Contributor
Thank you for helping us out…
- andrew_holbrookNew Contributor III
- robinFormer Employee
import com.fasterxml.jackson.databind.ObjectMapper;
The
org.codehaus.jackson
-package version is from an older version of Jackson. Thecom.fasterxml.jackson
-package version is the right one. See java - org.codehaus.jackson versus com.fasterxml.jackson.core - Stack Overflow for more.The implementation that is injected is
SnapObjectMapper
, which extendscom.fasterxml.jackson.databind.ObjectMapper
. It enables some Jackson serialization features by default, as well as some custom serializers for Dates/Times/DateTimes.