[ https://issues.apache.org/jira/browse/NIFI-4800?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16394942#comment-16394942 ]
ASF GitHub Bot commented on NIFI-4800: -------------------------------------- Github user pvillard31 commented on a diff in the pull request: https://github.com/apache/nifi/pull/2530#discussion_r173719906 --- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/groovy/org/apache/nifi/processors/standard/TestFlattenJson.groovy --- @@ -134,4 +134,44 @@ class TestFlattenJson { ]) } } + + @Test + void testFlattenModeNormal() { + def testRunner = TestRunners.newTestRunner(FlattenJson.class) + def json = prettyPrint(toJson([ + first: [ + second: [ + third: [ + "one", "two", "three", "four", "five" + ] + ] + ] + ])) + + testRunner.setValidateExpressionUsage(true); + testRunner.setProperty(FlattenJson.FLATTEN_MODE, FlattenJson.FLATTEN_MODE_NORMAL) + baseTest(testRunner, json,5) { parsed -> + Assert.assertEquals("Separator not applied.", "one", parsed["first.second.third[0]"]) + } + } + + @Test + void testFlattenModeDotNotation() { + def testRunner = TestRunners.newTestRunner(FlattenJson.class) + def json = prettyPrint(toJson([ + first: [ + second: [ + third: [ + "one", "two", "three", "four", "five" + ] + ] + ] + ])) + + testRunner.setValidateExpressionUsage(true); --- End diff -- not sure this line is required > Expose the flattenMode as property in FlattenJSON processor > ----------------------------------------------------------- > > Key: NIFI-4800 > URL: https://issues.apache.org/jira/browse/NIFI-4800 > Project: Apache NiFi > Issue Type: Improvement > Components: Extensions > Affects Versions: 1.5.0 > Reporter: Alois Gruber > Assignee: Deon Huang > Priority: Trivial > > the flattening class supports 3 different modes, which cannot be selected in > the processor. Especially the flattening of arrays would be helpful -- This message was sent by Atlassian JIRA (v7.6.3#76005)