src/main/java/org/embulk/output/mailchimp/MailChimpAbstractRecordBuffer.java in embulk-output-mailchimp-0.3.3 vs src/main/java/org/embulk/output/mailchimp/MailChimpAbstractRecordBuffer.java in embulk-output-mailchimp-0.3.4
- old
+ new
@@ -32,10 +32,11 @@
import static org.embulk.output.mailchimp.helper.MailChimpHelper.containsCaseInsensitive;
import static org.embulk.output.mailchimp.helper.MailChimpHelper.fromCommaSeparatedString;
import static org.embulk.output.mailchimp.model.MemberStatus.PENDING;
import static org.embulk.output.mailchimp.model.MemberStatus.SUBSCRIBED;
+import static org.embulk.spi.type.Types.JSON;
/**
* Created by thangnc on 4/14/17.
*/
public abstract class MailChimpAbstractRecordBuffer
@@ -270,11 +271,16 @@
// Update additional merge fields if exist
if (task.getMergeFields().isPresent() && !task.getMergeFields().get().isEmpty()) {
for (final Column column : schema.getColumns()) {
if (!"".equals(containsCaseInsensitive(column.getName(), task.getMergeFields().get()))) {
- String value = input.findValue(column.getName()).asText();
- mergeFields.put(column.getName().toUpperCase(), value);
+ if (column.getType().equals(JSON)) {
+ mergeFields.set(column.getName().toUpperCase(), input.findValue(column.getName()));
+ }
+ else {
+ String value = input.findValue(column.getName()).asText();
+ mergeFields.put(column.getName().toUpperCase(), value);
+ }
}
}
}
property.set("merge_fields", mergeFields);