Hello David thank you for your answer. What you described works, but is not what I'm trying to achieve. I don't want to change the schema, because I don't know the type of the field in the input flowfile. I used int as an example but it could be some other type and I want to convert it to string nevertheless.
To my understanding, when I configure the schema on the reader with string, the field should be coerced to string. This is described in the documentation of JsonTreeReader, in the additional details section. Then as you say the writer will inherit the schema and also format the field as a string. Correct me if I'm wrong or if this should be achieved some other way. As noted this used to work in nifi 1.14 and i didn't see any difference in that matter in the documentation. Thanks again for your time. On 2024/12/05 11:49:07 Dávid Szabó wrote: > Hi Bill, > > If you want to change the schema of your record you have to set a different > schema on your reader and writer, i.e. the reader should have the field as > int and the writer as string. > If ConvertRecord sees that the schema does not change it will just progress > the record as is without actually interpreting the schema. > You mentioned you did not change any default setting on > JsonRecordSetWriter. It means it is set to the "Inherit Record Schema" > strategy, which in your case just uses the schema set in the reader, so > ConvertRecord will not see a change in the schema. > > Regards, > David > > > Bill Tsek <bi...@gmail.com> ezt írta (időpont: 2024. dec. 4., Sze, > 17:47): > > > Trying to convert a record's field from int to string using a schema, the > > ConvertRecord processor, a JsonTreeReader and a JsonRecordSetWriter, > > doesn't seem to work. > > > > After the processor runs the field is still an int. > > > > The same example in nifi 1.14 works. > > > > Bellow I attached screenshots in order to reproduce. > > > > The flow: > > > > [image: image.png] > > > > The GenerateFlowFile properties: > > [image: image.png] > > > > The ConvertRecord properties: > > [image: image.png] > > The JsonTreeReader properties: > > [image: image.png] > > The schema.text: > > { > > "type" : "record", > > "namespace" : "schemas", > > "name" : "foo", > > "fields" : [ > > { "name" : "foo" , "type" : "string" } > > ] > > } > > > > The JsonRecordSetWriter properties has not been changed. > > > > The ConvertRecord processor's output: > > > > [ { > > "foo" : 5 > > } ] > > > > Thanks > > >