diff --git a/ksql-common/src/main/java/io/confluent/ksql/json/JsonMapper.java b/ksql-common/src/main/java/io/confluent/ksql/json/JsonMapper.java index 1a1418c4a726..f742d87cf990 100644 --- a/ksql-common/src/main/java/io/confluent/ksql/json/JsonMapper.java +++ b/ksql-common/src/main/java/io/confluent/ksql/json/JsonMapper.java @@ -32,5 +32,6 @@ public enum JsonMapper { mapper.registerModule(new KsqlTypesSerializationModule()); mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); mapper.enable(DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS); + mapper.enable(JsonGenerator.Feature.WRITE_BIGDECIMAL_AS_PLAIN); } } \ No newline at end of file diff --git a/ksql-common/src/test/java/io/confluent/ksql/json/JsonMapperTest.java b/ksql-common/src/test/java/io/confluent/ksql/json/JsonMapperTest.java index a1d9890f4dc4..740ab7483f4c 100644 --- a/ksql-common/src/test/java/io/confluent/ksql/json/JsonMapperTest.java +++ b/ksql-common/src/test/java/io/confluent/ksql/json/JsonMapperTest.java @@ -21,6 +21,7 @@ import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; +import java.math.BigDecimal; import org.junit.Test; public class JsonMapperTest { @@ -36,4 +37,13 @@ public void shouldNotAutoCloseTarget() { public void shouldIgnoreUnknownProperties() { assertThat(OBJECT_MAPPER.isEnabled(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES), is(false)); } + + @Test + public void shouldNotUseScientificNotationWhenSerializingDecimals() throws Exception { + // When: + final String result = OBJECT_MAPPER.writeValueAsString(new BigDecimal("1e+1")); + + // Then: + assertThat(result, is("10")); + } } \ No newline at end of file