Support Questions

Find answers, ask questions, and share your expertise

Input values are converted to String after going through Record Reader / Record Writer

New Contributor

Hello community,

We are experiencing an invalid scenario in our implementation.

After receiving an input JSON with integer values from ListenHTTP processor, the values are sent to a Kafka processor which uses JsonTreeReader 1.4.0 as record reader and JsonRecordSetWriter 1.4.0 as record writer.

After this processing, integer values from JSON are converted to String.

Is this the correct behavior?

Is there a way to keep the original format?



"sample": 123




"sample": "123"





Super Guru

Can you share your input/output schemas? My guess is that in the schema, the data type is specified as "string" rather than "int".

New Contributor

Sure, schema is something similar to:

"fields": [ { "name": "sample", "type": "string"}]

I understand now that the type of field will define the output type of our writer.

A new question came out, is it possible to have the record invalidated since the sample came as 123 int instead of "123" string?

We would like to avoid the type coercion provided by JsonTreeReader:

Super Guru

You should be able to use ValidateRecord using the original schema, if types are coerced by a reader/writer (which I think might be a bug if they do), then they should fail validation (assuming the same bug/behavior is not in both places).

Take a Tour of the Community
Don't have an account?
Your experience may be limited. Sign in to explore more.