This is an automated email from the ASF dual-hosted git repository.

exceptionfactory pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git


The following commit(s) were added to refs/heads/main by this push:
     new 041ae48ff47 NIFI-12456 Added Parsing Strategy to JsonTreeReader and 
JsonPathReader with Lenient Option (#11208)
041ae48ff47 is described below

commit 041ae48ff473df405e77a0e8fe83534eab3ee9c1
Author: dan-s1 <[email protected]>
AuthorDate: Mon Jun 1 21:25:20 2026 -0400

    NIFI-12456 Added Parsing Strategy to JsonTreeReader and JsonPathReader with 
Lenient Option (#11208)
    
    Signed-off-by: David Handermann <[email protected]>
---
 .../nifi/json/AbstractJsonRowRecordReader.java     | 13 ++--
 .../org/apache/nifi/json/JsonParserFactory.java    | 15 +++-
 .../org/apache/nifi/json/JsonRecordSource.java     |  6 +-
 .../java/org/apache/nifi/json/ParsingStrategy.java | 53 ++++++++++++++
 .../apache/nifi/json/TestJsonParserFactory.java    | 81 ++++++++++++++++++++++
 .../org/apache/nifi/yaml/YamlParserFactory.java    |  4 +-
 .../java/org/apache/nifi/json/JsonPathReader.java  | 25 ++++++-
 .../java/org/apache/nifi/json/JsonTreeReader.java  | 28 ++++----
 .../java/org/apache/nifi/yaml/YamlTreeReader.java  | 21 +++---
 ...JsonTreeReader.java => TestJsonPathReader.java} | 37 ++++++----
 .../org/apache/nifi/json/TestJsonTreeReader.java   | 30 +++++---
 .../nifi/json/TestJsonTreeRowRecordReader.java     | 33 ++++-----
 .../TestYamlTreeReader.java}                       | 43 +++++++++---
 13 files changed, 302 insertions(+), 87 deletions(-)

diff --git 
a/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-json-record-utils/src/main/java/org/apache/nifi/json/AbstractJsonRowRecordReader.java
 
b/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-json-record-utils/src/main/java/org/apache/nifi/json/AbstractJsonRowRecordReader.java
index 99dc06d7ef3..b1e9c4fe1e6 100644
--- 
a/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-json-record-utils/src/main/java/org/apache/nifi/json/AbstractJsonRowRecordReader.java
+++ 
b/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-json-record-utils/src/main/java/org/apache/nifi/json/AbstractJsonRowRecordReader.java
@@ -52,6 +52,8 @@ import java.util.Optional;
 import java.util.function.BiPredicate;
 
 public abstract class AbstractJsonRowRecordReader implements RecordReader {
+    public static final String OBSOLETE_ALLOW_COMMENTS = "Allow Comments";
+
     public static final String DEFAULT_MAX_STRING_LENGTH = "20 MB";
 
     public static final PropertyDescriptor MAX_STRING_LENGTH = new 
PropertyDescriptor.Builder()
@@ -62,13 +64,12 @@ public abstract class AbstractJsonRowRecordReader 
implements RecordReader {
             .addValidator(StandardValidators.DATA_SIZE_VALIDATOR)
             .build();
 
-    public static final PropertyDescriptor ALLOW_COMMENTS = new 
PropertyDescriptor.Builder()
-            .name("Allow Comments")
-            .description("Whether to allow comments when parsing the JSON 
document")
+    public static final PropertyDescriptor PARSING_STRATEGY = new 
PropertyDescriptor.Builder()
+            .name("Parsing Strategy")
+            .description("Set the strategy for the level of JSON specification 
conformity required")
             .required(true)
-            .allowableValues("true", "false")
-            .defaultValue("false")
-            .addValidator(StandardValidators.BOOLEAN_VALIDATOR)
+            .allowableValues(ParsingStrategy.class)
+            .defaultValue(ParsingStrategy.STANDARD)
             .build();
 
     private final ComponentLog logger;
diff --git 
a/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-json-record-utils/src/main/java/org/apache/nifi/json/JsonParserFactory.java
 
b/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-json-record-utils/src/main/java/org/apache/nifi/json/JsonParserFactory.java
index dc675c7340f..21c8f273343 100644
--- 
a/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-json-record-utils/src/main/java/org/apache/nifi/json/JsonParserFactory.java
+++ 
b/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-json-record-utils/src/main/java/org/apache/nifi/json/JsonParserFactory.java
@@ -42,14 +42,23 @@ public class JsonParserFactory implements 
TokenParserFactory {
      * JSON Parser Factory constructor with configurable constraints
      *
      * @param streamReadConstraints Stream Read Constraints
-     * @param allowComments Allow Comments during parsing
+     * @param parsingStrategy Parsing strategy which determines how the JSON 
should be parsed.
      */
-    public JsonParserFactory(final StreamReadConstraints 
streamReadConstraints, final boolean allowComments) {
+    public JsonParserFactory(final StreamReadConstraints 
streamReadConstraints, final ParsingStrategy parsingStrategy) {
         Objects.requireNonNull(streamReadConstraints, "Stream Read Constraints 
required");
 
         final ObjectMapper objectMapper = new ObjectMapper();
-        if (allowComments) {
+        if (ParsingStrategy.LENIENT == parsingStrategy) {
             
objectMapper.enable(JsonReadFeature.ALLOW_JAVA_COMMENTS.mappedFeature());
+            
objectMapper.enable(JsonReadFeature.ALLOW_YAML_COMMENTS.mappedFeature());
+            
objectMapper.enable(JsonReadFeature.ALLOW_SINGLE_QUOTES.mappedFeature());
+            
objectMapper.enable(JsonReadFeature.ALLOW_UNQUOTED_FIELD_NAMES.mappedFeature());
+            
objectMapper.enable(JsonReadFeature.ALLOW_LEADING_PLUS_SIGN_FOR_NUMBERS.mappedFeature());
+            
objectMapper.enable(JsonReadFeature.ALLOW_LEADING_ZEROS_FOR_NUMBERS.mappedFeature());
+            
objectMapper.enable(JsonReadFeature.ALLOW_TRAILING_DECIMAL_POINT_FOR_NUMBERS.mappedFeature());
+            
objectMapper.enable(JsonReadFeature.ALLOW_TRAILING_COMMA.mappedFeature());
+            
objectMapper.enable(JsonReadFeature.ALLOW_MISSING_VALUES.mappedFeature());
+            
objectMapper.enable(JsonReadFeature.ALLOW_UNESCAPED_CONTROL_CHARS.mappedFeature());
         }
         jsonFactory = objectMapper.getFactory();
         jsonFactory.setStreamReadConstraints(streamReadConstraints);
diff --git 
a/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-json-record-utils/src/main/java/org/apache/nifi/json/JsonRecordSource.java
 
b/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-json-record-utils/src/main/java/org/apache/nifi/json/JsonRecordSource.java
index 13b51736fac..242e8982616 100644
--- 
a/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-json-record-utils/src/main/java/org/apache/nifi/json/JsonRecordSource.java
+++ 
b/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-json-record-utils/src/main/java/org/apache/nifi/json/JsonRecordSource.java
@@ -33,15 +33,13 @@ public class JsonRecordSource implements 
RecordSource<JsonNode> {
 
     private static final StreamReadConstraints DEFAULT_STREAM_READ_CONSTRAINTS 
= StreamReadConstraints.defaults();
 
-    private static final boolean ALLOW_COMMENTS_ENABLED = true;
-
-    private static final TokenParserFactory defaultTokenParserFactory = new 
JsonParserFactory(DEFAULT_STREAM_READ_CONSTRAINTS, ALLOW_COMMENTS_ENABLED);
+    private static final TokenParserFactory DEFAULT_TOKEN_PARSER_FACTORY = new 
JsonParserFactory(DEFAULT_STREAM_READ_CONSTRAINTS, ParsingStrategy.LENIENT);
 
     private final JsonParser jsonParser;
     private final StartingFieldStrategy strategy;
 
     public JsonRecordSource(final InputStream in) throws IOException {
-        this(in, null, null, defaultTokenParserFactory);
+        this(in, null, null, DEFAULT_TOKEN_PARSER_FACTORY);
     }
 
     public JsonRecordSource(final InputStream in, final StartingFieldStrategy 
strategy, final String startingFieldName, final TokenParserFactory 
tokenParserFactory) throws IOException {
diff --git 
a/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-json-record-utils/src/main/java/org/apache/nifi/json/ParsingStrategy.java
 
b/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-json-record-utils/src/main/java/org/apache/nifi/json/ParsingStrategy.java
new file mode 100644
index 00000000000..2b8e1325657
--- /dev/null
+++ 
b/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-json-record-utils/src/main/java/org/apache/nifi/json/ParsingStrategy.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.json;
+
+import org.apache.nifi.components.DescribedValue;
+
+public enum ParsingStrategy implements DescribedValue {
+    STANDARD("Standard", "Parse JSON per the JSON specification"),
+    LENIENT("Lenient", """
+            Parse JSON leniently allowing Java comments (/**/ and //), Yaml 
comments (start of line begins with #)
+            , leading plus sign in numbers (e.g. +123), leading zeros in 
numbers (e.g. 0001),
+            "missing" decimal numbers to end with a decimal point (e.g. 123.),
+            "missing value" in an array (i.e. sequence of two commas, without 
value in-between e.g. ["A",,"C"]),
+            trailing comma in an array or member in an object, use of single 
quotes for quoting strings (i.e. use of an apostrophe)
+            use of unquoted field names and use of unescaped control 
characters (ASCII characters with value less than 32).""");
+
+    private final String displayName;
+    private final String description;
+
+    ParsingStrategy(String displayName, String description) {
+        this.displayName = displayName;
+        this.description = description;
+    }
+
+    @Override
+    public String getValue() {
+        return name();
+    }
+
+    @Override
+    public String getDisplayName() {
+        return displayName;
+    }
+
+    @Override
+    public String getDescription() {
+        return description;
+    }
+}
diff --git 
a/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-json-record-utils/src/test/java/org/apache/nifi/json/TestJsonParserFactory.java
 
b/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-json-record-utils/src/test/java/org/apache/nifi/json/TestJsonParserFactory.java
new file mode 100644
index 00000000000..83cfc8c4299
--- /dev/null
+++ 
b/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-json-record-utils/src/test/java/org/apache/nifi/json/TestJsonParserFactory.java
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.json;
+
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.StreamReadConstraints;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
+import java.util.stream.Stream;
+
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+public class TestJsonParserFactory {
+    private static final String LENIENT_JSON = """
+            {
+              // Java-style single line comment
+              /* C-style multi-line
+                 comment */
+              "numbers": {
+                "leadingZero": 00042,
+                "leadingPlus": +123,
+                "missingDecimal": 10.
+              },
+              "quotes": {
+                'singleQuotedKey': 'value',
+                unquotedKey: "value"
+              },
+              "arrayMissingValue": [
+                "first",
+                ,
+                "third",
+              ],
+              "objectTrailing": {
+                "key": "value",
+              }
+            }
+            """;
+
+    @ParameterizedTest
+    @MethodSource("jsonParsing")
+    void testJsonParsing(ParsingStrategy parsingStrategy) throws Exception {
+        final StreamReadConstraints streamReadConstraints = 
StreamReadConstraints.builder().build();
+        final JsonParserFactory jsonParserFactory = new 
JsonParserFactory(streamReadConstraints, parsingStrategy);
+        final InputStream inputStream = new 
ByteArrayInputStream(LENIENT_JSON.getBytes(StandardCharsets.UTF_8));
+        final JsonParser jsonParser = 
jsonParserFactory.getJsonParser(inputStream);
+
+        if (ParsingStrategy.LENIENT == parsingStrategy) {
+            assertDoesNotThrow(() -> jsonParser.readValueAsTree());
+        } else {
+            assertThrows(JsonParseException.class, 
jsonParser::readValueAsTree);
+        }
+    }
+
+    private static Stream<Arguments> jsonParsing() {
+        return Stream.of(
+                Arguments.argumentSet("Standard", ParsingStrategy.STANDARD),
+                Arguments.argumentSet("Lenient", ParsingStrategy.LENIENT)
+        );
+    }
+}
diff --git 
a/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-yaml-record-utils/src/main/java/org/apache/nifi/yaml/YamlParserFactory.java
 
b/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-yaml-record-utils/src/main/java/org/apache/nifi/yaml/YamlParserFactory.java
index a79c7d417b5..601d542326a 100644
--- 
a/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-yaml-record-utils/src/main/java/org/apache/nifi/yaml/YamlParserFactory.java
+++ 
b/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-yaml-record-utils/src/main/java/org/apache/nifi/yaml/YamlParserFactory.java
@@ -45,14 +45,12 @@ public class YamlParserFactory implements 
TokenParserFactory {
      * YAML Parser Factory constructor with configurable parsing constraints
      *
      * @param streamReadConstraints Stream Read Constraints required
-     * @param allowComments Allow Comments during parsing
      */
-    public YamlParserFactory(final StreamReadConstraints 
streamReadConstraints, final boolean allowComments) {
+    public YamlParserFactory(final StreamReadConstraints 
streamReadConstraints) {
         Objects.requireNonNull(streamReadConstraints, "Stream Read Constraints 
required");
 
         final LoaderOptions loaderOptions = new LoaderOptions();
         
loaderOptions.setCodePointLimit(streamReadConstraints.getMaxStringLength());
-        loaderOptions.setProcessComments(allowComments);
 
         yamlFactory = 
YAMLFactory.builder().loaderOptions(loaderOptions).build();
         yamlFactory.setCodec(yamlMapper);
diff --git 
a/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/main/java/org/apache/nifi/json/JsonPathReader.java
 
b/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/main/java/org/apache/nifi/json/JsonPathReader.java
index 7ac13373cbf..4c1310449f1 100644
--- 
a/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/main/java/org/apache/nifi/json/JsonPathReader.java
+++ 
b/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/main/java/org/apache/nifi/json/JsonPathReader.java
@@ -34,6 +34,7 @@ import org.apache.nifi.context.PropertyContext;
 import org.apache.nifi.controller.ConfigurationContext;
 import org.apache.nifi.expression.ExpressionLanguageScope;
 import org.apache.nifi.logging.ComponentLog;
+import org.apache.nifi.migration.PropertyConfiguration;
 import org.apache.nifi.processor.DataUnit;
 import org.apache.nifi.schema.access.SchemaAccessStrategy;
 import org.apache.nifi.schema.access.SchemaNotFoundException;
@@ -83,7 +84,7 @@ public class JsonPathReader extends SchemaRegistryService 
implements RecordReade
     protected List<PropertyDescriptor> getSupportedPropertyDescriptors() {
         final List<PropertyDescriptor> properties = new 
ArrayList<>(super.getSupportedPropertyDescriptors());
         properties.add(AbstractJsonRowRecordReader.MAX_STRING_LENGTH);
-        properties.add(AbstractJsonRowRecordReader.ALLOW_COMMENTS);
+        properties.add(AbstractJsonRowRecordReader.PARSING_STRATEGY);
         properties.add(DateTimeUtils.DATE_FORMAT);
         properties.add(DateTimeUtils.TIME_FORMAT);
         properties.add(DateTimeUtils.TIMESTAMP_FORMAT);
@@ -113,8 +114,9 @@ public class JsonPathReader extends SchemaRegistryService 
implements RecordReade
         this.objectMapper = new ObjectMapper();
         
objectMapper.getFactory().setStreamReadConstraints(streamReadConstraints);
 
-        final boolean allowComments = 
context.getProperty(AbstractJsonRowRecordReader.ALLOW_COMMENTS).asBoolean();
-        this.tokenParserFactory = new JsonParserFactory(streamReadConstraints, 
allowComments);
+        final ParsingStrategy parsingStrategy =
+                
context.getProperty(AbstractJsonRowRecordReader.PARSING_STRATEGY).asAllowableValue(ParsingStrategy.class);
+        this.tokenParserFactory = new JsonParserFactory(streamReadConstraints, 
parsingStrategy);
 
         final Map<String, JsonPath> compiled = new LinkedHashMap<>();
         for (final PropertyDescriptor descriptor : 
context.getProperties().keySet()) {
@@ -152,6 +154,23 @@ public class JsonPathReader extends SchemaRegistryService 
implements RecordReade
             .build());
     }
 
+    @Override
+    public void migrateProperties(PropertyConfiguration config) {
+        super.migrateProperties(config);
+
+        if 
(config.isPropertySet(AbstractJsonRowRecordReader.OBSOLETE_ALLOW_COMMENTS)) {
+            final String allowCommentsRawValue = 
config.getRawPropertyValue(AbstractJsonRowRecordReader.OBSOLETE_ALLOW_COMMENTS).orElse(Boolean.FALSE.toString());
+            final boolean allowComments = 
Boolean.parseBoolean(allowCommentsRawValue);
+            if (allowComments) {
+                
config.setProperty(AbstractJsonRowRecordReader.PARSING_STRATEGY, 
ParsingStrategy.LENIENT.getValue());
+            } else {
+                
config.setProperty(AbstractJsonRowRecordReader.PARSING_STRATEGY, 
ParsingStrategy.STANDARD.getValue());
+            }
+
+            
config.removeProperty(AbstractJsonRowRecordReader.OBSOLETE_ALLOW_COMMENTS);
+        }
+    }
+
     @Override
     protected List<AllowableValue> getSchemaAccessStrategyValues() {
         final List<AllowableValue> allowableValues = new 
ArrayList<>(super.getSchemaAccessStrategyValues());
diff --git 
a/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/main/java/org/apache/nifi/json/JsonTreeReader.java
 
b/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/main/java/org/apache/nifi/json/JsonTreeReader.java
index 8ceef18622e..4b2234883e4 100644
--- 
a/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/main/java/org/apache/nifi/json/JsonTreeReader.java
+++ 
b/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/main/java/org/apache/nifi/json/JsonTreeReader.java
@@ -117,7 +117,7 @@ public class JsonTreeReader extends SchemaRegistryService 
implements RecordReade
         properties.add(STARTING_FIELD_NAME);
         properties.add(SCHEMA_APPLICATION_STRATEGY);
         properties.add(AbstractJsonRowRecordReader.MAX_STRING_LENGTH);
-        properties.add(AbstractJsonRowRecordReader.ALLOW_COMMENTS);
+        properties.add(AbstractJsonRowRecordReader.PARSING_STRATEGY);
         properties.add(DateTimeUtils.DATE_FORMAT);
         properties.add(DateTimeUtils.TIME_FORMAT);
         properties.add(DateTimeUtils.TIMESTAMP_FORMAT);
@@ -142,10 +142,24 @@ public class JsonTreeReader extends SchemaRegistryService 
implements RecordReade
         config.renameProperty("starting-field-name", 
STARTING_FIELD_NAME.getName());
         config.renameProperty("schema-application-strategy", 
SCHEMA_APPLICATION_STRATEGY.getName());
         config.renameProperty(OBSOLETE_SCHEMA_CACHE, SCHEMA_CACHE.getName());
+
+        if 
(config.isPropertySet(AbstractJsonRowRecordReader.OBSOLETE_ALLOW_COMMENTS)) {
+            final String allowCommentsRawValue = 
config.getRawPropertyValue(AbstractJsonRowRecordReader.OBSOLETE_ALLOW_COMMENTS).orElse(Boolean.FALSE.toString());
+            final boolean allowComments = 
Boolean.parseBoolean(allowCommentsRawValue);
+            if (allowComments) {
+                
config.setProperty(AbstractJsonRowRecordReader.PARSING_STRATEGY, 
ParsingStrategy.LENIENT.getValue());
+            } else {
+                
config.setProperty(AbstractJsonRowRecordReader.PARSING_STRATEGY, 
ParsingStrategy.STANDARD.getValue());
+            }
+
+            
config.removeProperty(AbstractJsonRowRecordReader.OBSOLETE_ALLOW_COMMENTS);
+        }
     }
 
     protected TokenParserFactory createTokenParserFactory(final 
ConfigurationContext context) {
-        return new JsonParserFactory(buildStreamReadConstraints(context), 
isAllowCommentsEnabled(context));
+        final ParsingStrategy parsingStrategy =
+                
context.getProperty(AbstractJsonRowRecordReader.PARSING_STRATEGY).asAllowableValue(ParsingStrategy.class);
+        return new JsonParserFactory(buildStreamReadConstraints(context), 
parsingStrategy);
     }
 
     /**
@@ -159,16 +173,6 @@ public class JsonTreeReader extends SchemaRegistryService 
implements RecordReade
         return 
StreamReadConstraints.builder().maxStringLength(maxStringLength).build();
     }
 
-    /**
-     * Determine whether to allow comments when parsing based on available 
properties
-     *
-     * @param context Configuration Context with property values
-     * @return Allow comments status
-     */
-    protected boolean isAllowCommentsEnabled(final ConfigurationContext 
context) {
-        return 
context.getProperty(AbstractJsonRowRecordReader.ALLOW_COMMENTS).asBoolean();
-    }
-
     @Override
     protected List<AllowableValue> getSchemaAccessStrategyValues() {
         final List<AllowableValue> allowableValues = new ArrayList<>();
diff --git 
a/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/main/java/org/apache/nifi/yaml/YamlTreeReader.java
 
b/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/main/java/org/apache/nifi/yaml/YamlTreeReader.java
index 8569103d374..347a992481b 100644
--- 
a/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/main/java/org/apache/nifi/yaml/YamlTreeReader.java
+++ 
b/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/main/java/org/apache/nifi/yaml/YamlTreeReader.java
@@ -21,10 +21,12 @@ import 
org.apache.nifi.annotation.documentation.CapabilityDescription;
 import org.apache.nifi.annotation.documentation.Tags;
 import org.apache.nifi.components.PropertyDescriptor;
 import org.apache.nifi.controller.ConfigurationContext;
+import org.apache.nifi.json.AbstractJsonRowRecordReader;
 import org.apache.nifi.json.JsonTreeReader;
 import org.apache.nifi.json.JsonTreeRowRecordReader;
 import org.apache.nifi.json.TokenParserFactory;
 import org.apache.nifi.logging.ComponentLog;
+import org.apache.nifi.migration.PropertyConfiguration;
 import org.apache.nifi.serialization.MalformedRecordException;
 import org.apache.nifi.serialization.record.RecordSchema;
 
@@ -44,16 +46,24 @@ import java.util.List;
         + "See the Usage of the Controller Service for more information and 
examples.")
 public class YamlTreeReader extends JsonTreeReader {
 
-    private static final boolean ALLOW_COMMENTS_DISABLED = false;
+    @Override
+    public void migrateProperties(PropertyConfiguration config) {
+        super.migrateProperties(config);
+        // Remove Parsing Strategy from potential addition through the parent 
JsonTreeReader property migration
+        
config.removeProperty(AbstractJsonRowRecordReader.PARSING_STRATEGY.getName());
+    }
 
     @Override
     protected List<PropertyDescriptor> getSupportedPropertyDescriptors() {
-        return new ArrayList<>(super.getSupportedPropertyDescriptors());
+        final List<PropertyDescriptor> supportedPropertyDescriptors = new 
ArrayList<>(super.getSupportedPropertyDescriptors());
+        
supportedPropertyDescriptors.remove(AbstractJsonRowRecordReader.PARSING_STRATEGY);
+
+        return  supportedPropertyDescriptors;
     }
 
     @Override
     protected TokenParserFactory createTokenParserFactory(final 
ConfigurationContext context) {
-        return new YamlParserFactory(buildStreamReadConstraints(context), 
isAllowCommentsEnabled(context));
+        return new YamlParserFactory(buildStreamReadConstraints(context));
     }
 
     @Override
@@ -61,9 +71,4 @@ public class YamlTreeReader extends JsonTreeReader {
         return new YamlTreeRowRecordReader(in, logger, schema, dateFormat, 
timeFormat, timestampFormat, startingFieldStrategy, startingFieldName,
                 schemaApplicationStrategy, null);
     }
-
-    @Override
-    protected boolean isAllowCommentsEnabled(final ConfigurationContext 
context) {
-        return ALLOW_COMMENTS_DISABLED;
-    }
 }
diff --git 
a/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/json/TestJsonTreeReader.java
 
b/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/json/TestJsonPathReader.java
similarity index 71%
copy from 
nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/json/TestJsonTreeReader.java
copy to 
nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/json/TestJsonPathReader.java
index 0fa55a7cfd3..c6b7ed04a84 100644
--- 
a/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/json/TestJsonTreeReader.java
+++ 
b/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/json/TestJsonPathReader.java
@@ -19,9 +19,13 @@ package org.apache.nifi.json;
 import org.apache.nifi.schema.access.SchemaAccessUtils;
 import org.apache.nifi.util.MockPropertyConfiguration;
 import org.apache.nifi.util.PropertyMigrationResult;
-import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
 
 import java.util.Map;
+import java.util.Set;
+import java.util.stream.Stream;
 
 import static 
org.apache.nifi.schema.access.SchemaAccessUtils.SCHEMA_ACCESS_STRATEGY;
 import static 
org.apache.nifi.schema.access.SchemaAccessUtils.SCHEMA_BRANCH_NAME;
@@ -30,20 +34,14 @@ import static 
org.apache.nifi.schema.access.SchemaAccessUtils.SCHEMA_REFERENCE_R
 import static org.apache.nifi.schema.access.SchemaAccessUtils.SCHEMA_REGISTRY;
 import static org.apache.nifi.schema.access.SchemaAccessUtils.SCHEMA_TEXT;
 import static org.apache.nifi.schema.access.SchemaAccessUtils.SCHEMA_VERSION;
-import static 
org.apache.nifi.schema.inference.SchemaInferenceUtil.OBSOLETE_SCHEMA_CACHE;
-import static 
org.apache.nifi.schema.inference.SchemaInferenceUtil.SCHEMA_CACHE;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 
-public class TestJsonTreeReader {
+public class TestJsonPathReader {
 
-    @Test
-    void testMigrateProperties() {
-        final JsonTreeReader service = new JsonTreeReader();
+    @ParameterizedTest
+    @MethodSource("migrationConfigurations")
+    void testMigrateProperties(MockPropertyConfiguration configuration, 
Set<String> expectedRemoved) {
         final Map<String, String> expectedRenamed = Map.ofEntries(
-                Map.entry("starting-field-strategy", 
JsonTreeReader.STARTING_FIELD_STRATEGY.getName()),
-                Map.entry("starting-field-name", 
JsonTreeReader.STARTING_FIELD_NAME.getName()),
-                Map.entry("schema-application-strategy", 
JsonTreeReader.SCHEMA_APPLICATION_STRATEGY.getName()),
-                Map.entry(OBSOLETE_SCHEMA_CACHE, SCHEMA_CACHE.getName()),
                 
Map.entry(SchemaAccessUtils.OLD_SCHEMA_ACCESS_STRATEGY_PROPERTY_NAME, 
SCHEMA_ACCESS_STRATEGY.getName()),
                 Map.entry(SchemaAccessUtils.OLD_SCHEMA_REGISTRY_PROPERTY_NAME, 
SCHEMA_REGISTRY.getName()),
                 Map.entry(SchemaAccessUtils.OLD_SCHEMA_NAME_PROPERTY_NAME, 
SCHEMA_NAME.getName()),
@@ -53,13 +51,22 @@ public class TestJsonTreeReader {
                 
Map.entry(SchemaAccessUtils.OLD_SCHEMA_REFERENCE_READER_PROPERTY_NAME, 
SCHEMA_REFERENCE_READER.getName())
         );
 
-        final Map<String, String> propertyValues = Map.of();
-        final MockPropertyConfiguration configuration = new 
MockPropertyConfiguration(propertyValues);
+        final JsonPathReader service = new JsonPathReader();
         service.migrateProperties(configuration);
-
         final PropertyMigrationResult result = 
configuration.toPropertyMigrationResult();
-        final Map<String, String> propertiesRenamed = 
result.getPropertiesRenamed();
 
+        final Map<String, String> propertiesRenamed = 
result.getPropertiesRenamed();
         assertEquals(expectedRenamed, propertiesRenamed);
+
+        final Set<String> propertiesRemoved = result.getPropertiesRemoved();
+        assertEquals(expectedRemoved, propertiesRemoved);
+    }
+
+    private static Stream<Arguments> migrationConfigurations() {
+        return Stream.of(
+                Arguments.argumentSet("Configuration without allow comments", 
new MockPropertyConfiguration(Map.of()), Set.of()),
+                Arguments.argumentSet("Configuration with allow comments",
+                        new 
MockPropertyConfiguration(Map.of(AbstractJsonRowRecordReader.OBSOLETE_ALLOW_COMMENTS,
 "true")), Set.of(AbstractJsonRowRecordReader.OBSOLETE_ALLOW_COMMENTS))
+        );
     }
 }
diff --git 
a/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/json/TestJsonTreeReader.java
 
b/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/json/TestJsonTreeReader.java
index 0fa55a7cfd3..c202c489bc7 100644
--- 
a/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/json/TestJsonTreeReader.java
+++ 
b/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/json/TestJsonTreeReader.java
@@ -19,9 +19,13 @@ package org.apache.nifi.json;
 import org.apache.nifi.schema.access.SchemaAccessUtils;
 import org.apache.nifi.util.MockPropertyConfiguration;
 import org.apache.nifi.util.PropertyMigrationResult;
-import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
 
 import java.util.Map;
+import java.util.Set;
+import java.util.stream.Stream;
 
 import static 
org.apache.nifi.schema.access.SchemaAccessUtils.SCHEMA_ACCESS_STRATEGY;
 import static 
org.apache.nifi.schema.access.SchemaAccessUtils.SCHEMA_BRANCH_NAME;
@@ -36,9 +40,9 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
 
 public class TestJsonTreeReader {
 
-    @Test
-    void testMigrateProperties() {
-        final JsonTreeReader service = new JsonTreeReader();
+    @ParameterizedTest
+    @MethodSource("migrationConfigurations")
+    void testMigrateProperties(MockPropertyConfiguration configuration, 
Set<String> expectedRemoved) {
         final Map<String, String> expectedRenamed = Map.ofEntries(
                 Map.entry("starting-field-strategy", 
JsonTreeReader.STARTING_FIELD_STRATEGY.getName()),
                 Map.entry("starting-field-name", 
JsonTreeReader.STARTING_FIELD_NAME.getName()),
@@ -53,13 +57,23 @@ public class TestJsonTreeReader {
                 
Map.entry(SchemaAccessUtils.OLD_SCHEMA_REFERENCE_READER_PROPERTY_NAME, 
SCHEMA_REFERENCE_READER.getName())
         );
 
-        final Map<String, String> propertyValues = Map.of();
-        final MockPropertyConfiguration configuration = new 
MockPropertyConfiguration(propertyValues);
+        final JsonTreeReader service = new JsonTreeReader();
         service.migrateProperties(configuration);
-
         final PropertyMigrationResult result = 
configuration.toPropertyMigrationResult();
-        final Map<String, String> propertiesRenamed = 
result.getPropertiesRenamed();
 
+        final Map<String, String> propertiesRenamed = 
result.getPropertiesRenamed();
         assertEquals(expectedRenamed, propertiesRenamed);
+
+        final Set<String> propertiesRemoved = result.getPropertiesRemoved();
+        assertEquals(expectedRemoved, propertiesRemoved);
     }
+
+    private static Stream<Arguments> migrationConfigurations() {
+        return Stream.of(
+                Arguments.argumentSet("Configuration without allow comments", 
new MockPropertyConfiguration(Map.of()), Set.of()),
+                Arguments.argumentSet("Configuration with allow comments",
+                        new 
MockPropertyConfiguration(Map.of(AbstractJsonRowRecordReader.OBSOLETE_ALLOW_COMMENTS,
 "true")), Set.of(AbstractJsonRowRecordReader.OBSOLETE_ALLOW_COMMENTS))
+        );
+    }
+
 }
diff --git 
a/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/json/TestJsonTreeRowRecordReader.java
 
b/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/json/TestJsonTreeRowRecordReader.java
index 4cf0ee74d4e..260e4a10701 100644
--- 
a/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/json/TestJsonTreeRowRecordReader.java
+++ 
b/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/json/TestJsonTreeRowRecordReader.java
@@ -307,34 +307,34 @@ class TestJsonTreeRowRecordReader {
 
     @Test
     void testReadMultilineJSON() throws Exception {
-        
testReadAccountJson("src/test/resources/json/bank-account-multiline.json", 
false, null);
+        
testReadAccountJson("src/test/resources/json/bank-account-multiline.json", 
ParsingStrategy.STANDARD, null);
     }
 
     @Test
     void testReadJSONStringTooLong() {
         final StreamConstraintsException mre = 
assertThrows(StreamConstraintsException.class, () ->
-                
testReadAccountJson("src/test/resources/json/bank-account-multiline.json", 
false, StreamReadConstraints.builder().maxStringLength(2).build()));
+                
testReadAccountJson("src/test/resources/json/bank-account-multiline.json", 
ParsingStrategy.STANDARD, 
StreamReadConstraints.builder().maxStringLength(2).build()));
         assertTrue(mre.getMessage().contains("maximum"));
         assertTrue(mre.getMessage().contains("2"));
     }
 
     @Test
     void testReadJSONComments() throws Exception {
-        
testReadAccountJson("src/test/resources/json/bank-account-comments.jsonc", 
true, StreamReadConstraints.builder().maxStringLength(20_000).build());
+        
testReadAccountJson("src/test/resources/json/bank-account-comments.jsonc", 
ParsingStrategy.LENIENT, 
StreamReadConstraints.builder().maxStringLength(20_000).build());
     }
 
     @Test
     void testReadJSONDisallowComments() {
         assertThrows(MalformedRecordException.class, () ->
-            
testReadAccountJson("src/test/resources/json/bank-account-comments.jsonc", 
false, StreamReadConstraints.builder().maxStringLength(20_000).build()));
+            
testReadAccountJson("src/test/resources/json/bank-account-comments.jsonc", 
ParsingStrategy.STANDARD, 
StreamReadConstraints.builder().maxStringLength(20_000).build()));
     }
 
-    private void testReadAccountJson(final String inputFile, final boolean 
allowComments, final StreamReadConstraints streamReadConstraints) throws 
Exception {
+    private void testReadAccountJson(final String inputFile, final 
ParsingStrategy parsingStrategy, final StreamReadConstraints 
streamReadConstraints) throws Exception {
         final List<RecordField> fields = 
getFields(RecordFieldType.DECIMAL.getDecimalDataType(30, 10));
         final RecordSchema schema = new SimpleRecordSchema(fields);
 
         try (final InputStream in = new FileInputStream(inputFile);
-             final JsonTreeRowRecordReader reader = 
createJsonTreeRowRecordReader(in, schema, null, null, null, null, null, null, 
null, allowComments, streamReadConstraints)) {
+             final JsonTreeRowRecordReader reader = 
createJsonTreeRowRecordReader(in, schema, null, null, null, null, null, null, 
null, parsingStrategy, streamReadConstraints)) {
 
             final List<String> fieldNames = schema.getFieldNames();
             final List<String> expectedFieldNames = Arrays.asList("id", 
"name", "balance", "address", "city", "state", "zipCode", "country");
@@ -519,7 +519,7 @@ class TestJsonTreeRowRecordReader {
         final String json = String.format("{ \"%s\": \"%s\" }", dateField, 
date);
         for (final boolean coerceTypes : new boolean[] {true, false}) {
             try (final InputStream in = new 
ByteArrayInputStream(json.getBytes(StandardCharsets.UTF_8));
-                 final JsonTreeRowRecordReader reader = 
createJsonTreeRowRecordReader(in, schema, datePattern, timeFormat, 
timestampFormat, null, null, null, null, false, null)) {
+                 final JsonTreeRowRecordReader reader = 
createJsonTreeRowRecordReader(in, schema, datePattern, timeFormat, 
timestampFormat, null, null, null, null, ParsingStrategy.STANDARD, null)) {
 
                 final Record record = reader.nextRecord(coerceTypes, false);
                 final Object value = record.getValue(dateField);
@@ -536,7 +536,8 @@ class TestJsonTreeRowRecordReader {
 
         for (final boolean coerceTypes : new boolean[] {true, false}) {
             try (final InputStream in = new 
FileInputStream("src/test/resources/json/timestamp.json");
-                 final JsonTreeRowRecordReader reader = 
createJsonTreeRowRecordReader(in, schema, dateFormat, timeFormat, "yyyy/MM/dd 
HH:mm:ss", null, null, null, null, false, null)) {
+                 final JsonTreeRowRecordReader reader = 
createJsonTreeRowRecordReader(in, schema, dateFormat, timeFormat,
+                         "yyyy/MM/dd HH:mm:ss", null, null, null, null, 
ParsingStrategy.STANDARD, null)) {
 
                 final Record record = reader.nextRecord(coerceTypes, false);
                 final Object value = record.getValue("timestamp");
@@ -748,7 +749,7 @@ class TestJsonTreeRowRecordReader {
         final List<String> ids = new ArrayList<>();
         try (final InputStream in = new 
ByteArrayInputStream(inputJson.getBytes(StandardCharsets.UTF_8));
              final JsonTreeRowRecordReader reader = 
createJsonTreeRowRecordReader(in, bookSchema, dateFormat, timeFormat, 
timestampFormat,
-                     StartingFieldStrategy.NESTED_FIELD, "books", 
SchemaApplicationStrategy.SELECTED_PART, null, false, null)) {
+                     StartingFieldStrategy.NESTED_FIELD, "books", 
SchemaApplicationStrategy.SELECTED_PART, null, ParsingStrategy.STANDARD, null)) 
{
 
             Record record;
             while ((record = reader.nextRecord()) != null) {
@@ -777,7 +778,7 @@ class TestJsonTreeRowRecordReader {
         final StringBuilder labelsRead = new StringBuilder();
         try (final InputStream in = new 
ByteArrayInputStream(inputJson.getBytes(StandardCharsets.UTF_8));
              final JsonTreeRowRecordReader reader = 
createJsonTreeRowRecordReader(in, recordSchema, dateFormat, timeFormat, 
timestampFormat,
-                     StartingFieldStrategy.ROOT_NODE, null, 
SchemaApplicationStrategy.SELECTED_PART, null, false, null)
+                     StartingFieldStrategy.ROOT_NODE, null, 
SchemaApplicationStrategy.SELECTED_PART, null, ParsingStrategy.STANDARD, null)
         ) {
             final Record record = reader.nextRecord();
             assertNotNull(record, "Record not found");
@@ -806,7 +807,7 @@ class TestJsonTreeRowRecordReader {
         final List<String> ids = new ArrayList<>();
         try (final InputStream in = new 
ByteArrayInputStream(inputJson.getBytes(StandardCharsets.UTF_8));
              final JsonTreeRowRecordReader reader = 
createJsonTreeRowRecordReader(in, bookSchema, dateFormat, timeFormat, 
timestampFormat,
-                StartingFieldStrategy.NESTED_FIELD, "book", 
SchemaApplicationStrategy.SELECTED_PART, null, false, null)) {
+                StartingFieldStrategy.NESTED_FIELD, "book", 
SchemaApplicationStrategy.SELECTED_PART, null, ParsingStrategy.STANDARD, null)) 
{
 
             Record record;
             while ((record = reader.nextRecord()) != null) {
@@ -1261,7 +1262,7 @@ class TestJsonTreeRowRecordReader {
         try (InputStream in = new 
FileInputStream("src/test/resources/json/capture-fields.json")) {
             JsonTreeRowRecordReader reader = createJsonTreeRowRecordReader(in, 
recordSchema, dateFormat, timeFormat, timestampFormat,
                     StartingFieldStrategy.NESTED_FIELD, startingFieldName, 
SchemaApplicationStrategy.SELECTED_PART,
-                    capturePredicate, false, null);
+                    capturePredicate, ParsingStrategy.STANDARD, null);
 
             while (reader.nextRecord() != null) {
                 // continue reading
@@ -1348,7 +1349,7 @@ class TestJsonTreeRowRecordReader {
             throws Exception {
 
         try (JsonTreeRowRecordReader reader = 
createJsonTreeRowRecordReader(jsonStream, schema, dateFormat, timeFormat, 
timestampFormat,
-                strategy, startingFieldName, schemaApplicationStrategy, null, 
false, null)) {
+                strategy, startingFieldName, schemaApplicationStrategy, null, 
ParsingStrategy.STANDARD, null)) {
             List<Object> actual = new ArrayList<>();
             Record record;
 
@@ -1386,19 +1387,19 @@ class TestJsonTreeRowRecordReader {
     }
 
     private JsonTreeRowRecordReader createJsonTreeRowRecordReader(InputStream 
inputStream, RecordSchema recordSchema) throws Exception {
-        return createJsonTreeRowRecordReader(inputStream, recordSchema, 
dateFormat, timeFormat, timestampFormat, null, null, null, null, false, null);
+        return createJsonTreeRowRecordReader(inputStream, recordSchema, 
dateFormat, timeFormat, timestampFormat, null, null, null, null, 
ParsingStrategy.STANDARD, null);
     }
 
     private JsonTreeRowRecordReader createJsonTreeRowRecordReader(InputStream 
inputStream, RecordSchema recordSchema, String dateFormat, String timeFormat, 
String timestampFormat,
                                                                   
StartingFieldStrategy startingFieldStrategy, String startingFieldName, 
SchemaApplicationStrategy schemaApplicationStrategy,
-                                                                  
BiPredicate<String, String> captureFieldPredicate, boolean allowComments, 
StreamReadConstraints streamReadConstraints)
+                                                                  
BiPredicate<String, String> captureFieldPredicate, ParsingStrategy 
parsingStrategy, StreamReadConstraints streamReadConstraints)
             throws Exception {
 
         final TokenParserFactory tokenParserFactory;
         if (streamReadConstraints == null) {
             tokenParserFactory = new JsonParserFactory();
         } else {
-            tokenParserFactory = new JsonParserFactory(streamReadConstraints, 
allowComments);
+            tokenParserFactory = new JsonParserFactory(streamReadConstraints, 
parsingStrategy);
         }
 
         return new JsonTreeRowRecordReader(inputStream, log, recordSchema, 
dateFormat, timeFormat, timestampFormat, startingFieldStrategy, 
startingFieldName, schemaApplicationStrategy,
diff --git 
a/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/json/TestJsonTreeReader.java
 
b/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/yaml/TestYamlTreeReader.java
similarity index 66%
copy from 
nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/json/TestJsonTreeReader.java
copy to 
nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/yaml/TestYamlTreeReader.java
index 0fa55a7cfd3..81b94046411 100644
--- 
a/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/json/TestJsonTreeReader.java
+++ 
b/nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/yaml/TestYamlTreeReader.java
@@ -14,14 +14,22 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.nifi.json;
 
+package org.apache.nifi.yaml;
+
+import org.apache.nifi.json.AbstractJsonRowRecordReader;
+import org.apache.nifi.json.JsonTreeReader;
 import org.apache.nifi.schema.access.SchemaAccessUtils;
 import org.apache.nifi.util.MockPropertyConfiguration;
 import org.apache.nifi.util.PropertyMigrationResult;
 import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
 
 import java.util.Map;
+import java.util.Set;
+import java.util.stream.Stream;
 
 import static 
org.apache.nifi.schema.access.SchemaAccessUtils.SCHEMA_ACCESS_STRATEGY;
 import static 
org.apache.nifi.schema.access.SchemaAccessUtils.SCHEMA_BRANCH_NAME;
@@ -33,12 +41,18 @@ import static 
org.apache.nifi.schema.access.SchemaAccessUtils.SCHEMA_VERSION;
 import static 
org.apache.nifi.schema.inference.SchemaInferenceUtil.OBSOLETE_SCHEMA_CACHE;
 import static 
org.apache.nifi.schema.inference.SchemaInferenceUtil.SCHEMA_CACHE;
 import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
 
-public class TestJsonTreeReader {
-
+public class TestYamlTreeReader {
     @Test
-    void testMigrateProperties() {
-        final JsonTreeReader service = new JsonTreeReader();
+    void testGetSupportedPropertyDescriptors() {
+        final YamlTreeReader service = new YamlTreeReader();
+        
assertFalse(service.getSupportedPropertyDescriptors().contains(AbstractJsonRowRecordReader.PARSING_STRATEGY));
+    }
+
+    @ParameterizedTest
+    @MethodSource("migrationConfigurations")
+    void testMigrateProperties(MockPropertyConfiguration configuration, 
Set<String> expectedRemoved) {
         final Map<String, String> expectedRenamed = Map.ofEntries(
                 Map.entry("starting-field-strategy", 
JsonTreeReader.STARTING_FIELD_STRATEGY.getName()),
                 Map.entry("starting-field-name", 
JsonTreeReader.STARTING_FIELD_NAME.getName()),
@@ -53,13 +67,24 @@ public class TestJsonTreeReader {
                 
Map.entry(SchemaAccessUtils.OLD_SCHEMA_REFERENCE_READER_PROPERTY_NAME, 
SCHEMA_REFERENCE_READER.getName())
         );
 
-        final Map<String, String> propertyValues = Map.of();
-        final MockPropertyConfiguration configuration = new 
MockPropertyConfiguration(propertyValues);
+        final YamlTreeReader service = new YamlTreeReader();
         service.migrateProperties(configuration);
-
         final PropertyMigrationResult result = 
configuration.toPropertyMigrationResult();
-        final Map<String, String> propertiesRenamed = 
result.getPropertiesRenamed();
 
+        final Map<String, String> propertiesRenamed = 
result.getPropertiesRenamed();
         assertEquals(expectedRenamed, propertiesRenamed);
+
+        final Set<String> propertiesRemoved = result.getPropertiesRemoved();
+        assertEquals(expectedRemoved, propertiesRemoved);
+    }
+
+    private static Stream<Arguments> migrationConfigurations() {
+        return Stream.of(
+                Arguments.argumentSet("Configuration without allow comments",
+                        new MockPropertyConfiguration(Map.of()), 
Set.of(AbstractJsonRowRecordReader.PARSING_STRATEGY.getName())),
+                Arguments.argumentSet("Configuration with allow comments",
+                        new 
MockPropertyConfiguration(Map.of(AbstractJsonRowRecordReader.OBSOLETE_ALLOW_COMMENTS,
 "true")),
+                        
Set.of(AbstractJsonRowRecordReader.OBSOLETE_ALLOW_COMMENTS, 
AbstractJsonRowRecordReader.PARSING_STRATEGY.getName()))
+        );
     }
 }

Reply via email to