Hey, I got the same problem while reproducing your scenario:
18:05:46 AMT
ERROR
51f2c975-0186-1000-27d8-85a989a6d1c8
FlattenJson[id=51f2c975-0186-1000-27d8-85a989a6d1c8] Failed to
unflatten JSON: java.lang.ClassCastException: class
com.fasterxml.jackson.databind.node.TextNode cannot be cast to class
com.fasterxml.jackson.databind.node.ObjectNode
(com.fasterxml.jackson.databind.node.TextNode and
com.fasterxml.jackson.databind.node.ObjectNode are in unnamed module
of loader org.apache.nifi.nar.NarClassLoader @1642eeae)
But then I analyse closely your json structure:
{
"filename":"PLACES_ABC.csv",
"sourcing.SHA256":"d46884d5b9f2617a9f16e7a4e8b056036f07cb02cb85953c5065dd55ff8e3c33",
"sourcing.MD5":"dd74cb837e5e701cdfa1fa070703be48",
"sourcing.sourceSHA256":"e3daeb8cfd6db4aad20bb42900bc5fa4815eba7e55d97cb01a1a9674668f20b2",
"sourcing.sourceMD5":"a18eed985ddb04cbe13b487062628585",
"triage.datatype":"mdb",
"triage.mdb.version":"JET4",
"triage.mdb.tables":"PLACES::-::ACCOUNTS::-::VEHICLES",
"triage.mdb.table.rowcount":"9982",
"triage.mdb.table":"PLACES",
"triage.mdb.table.header":"FIELDA,FIELDB,FIELDC",
"triage.mdb.table.database":"ABC.mdb"
}
You got a property named table with value "PLACES", than you have a nested
header and database properties.
With the correct structure (add a property for the "PLACES" table), the
processor works as spected:
{
"filename":"PLACES_ABC.csv",
"sourcing":{
"SHA256":"d46884d5b9f2617a9f16e7a4e8b056036f07cb02cb85953c5065dd55ff8e3c33",
"MD5":"dd74cb837e5e701cdfa1fa070703be48",
"sourceSHA256":"e3daeb8cfd6db4aad20bb42900bc5fa4815eba7e55d97cb01a1a9674668f20b2",
"sourceMD5":"a18eed985ddb04cbe13b487062628585"
},
"triage":{
"datatype":"mdb",
"mdb":{
"version":"JET4",
"tables":"PLACES::-::ACCOUNTS::-::VEHICLES",
"table":{
"rowcount":"9982",
"table":"PLACES",
"header":"FIELDA,FIELDB,FIELDC",
"database":"ABC.mdb"
}
}
}
}
On Tue, Feb 14, 2023 at 4:11 PM James McMahon <[email protected]> wrote:
> I have used AttributeToJSON to generate this JSON:
>
>
> {"sourcing.SHA256":"d46884d5b9f2617a9f16e7a4e8b056036f07cb02cb85953c5065dd55ff8e3c33","sourcing.MD5":"dd74cb837e5e701cdfa1fa070703be48","filename":"PLACES_ABC.csv","sourcing.sourceSHA256":"e3daeb8cfd6db4aad20bb42900bc5fa4815eba7e55d97cb01a1a9674668f20b2","triage.datatype":"mdb","triage.mdb.version":"JET4","triage.mdb.tables":"PLACES::-::ACCOUNTS::-::VEHICLES","sourcing.sourceMD5":"a18eed985ddb04cbe13b487062628585","triage.mdb.table.rowcount":"9982","triage.mdb.table":"PLACES","triage.mdb.table.header":"FIELDA,FIELDB,FIELDC","triage.mdb.table.database":"ABC.mdb"}
>
>
> I try to employ a FlattenJSON to (un)flatten my JSON. It is configured
> like so:
> Separator .
> F M dot notation
> IRC false
> RT unflatten
> CS UTF-8
> PPJ false
>
>
> This error below results. Why? How can I get past this problem?
>
> 19:54:40 UTC
> ERROR
> 4d6c3f2a-a72e-16b2-68ac-c90d5c31498d
>
> FlattenJson[id=4d6c3f2a-a72e-16b2-68ac-c90d5c31498d] Failed to unflatten
> JSON: java.lang.ClassCastException: class
> com.fasterxml.jackson.databind.node.TextNode cannot be cast to class
> com.fasterxml.jackson.databind.node.ObjectNode
> (com.fasterxml.jackson.databind.node.TextNode and
> com.fasterxml.jackson.databind.node.ObjectNode are in unnamed module of
> loader org.apache.nifi.nar.NarClassLoader @2679311f)
>
>
>
>
>
>
>
>
>
>
>
>