ChrisSamo632 commented on code in PR #7745: URL: https://github.com/apache/nifi/pull/7745#discussion_r1420713574
########## nifi-commons/nifi-record-path/src/test/java/org/apache/nifi/record/path/TestRecordPath.java: ########## @@ -1837,7 +1838,41 @@ public void testUnescapeJson() { put("firstName", "John"); put("age", 30); }}, "json_str"), - RecordPath.compile("unescapeJson(/json_str, 'true')").evaluate(recordFromMap).getSelectedFields().findFirst().orElseThrow(IllegalStateException::new).getValue() + RecordPath.compile("unescapeJson(/json_str, 'true')").evaluate(recordFromMap).getSelectedFields().findFirst().orElseThrow(AssertionError::new).getValue() + ); + + // test nested Record converted from Map Object + final Record nestedRecordFromMap = new MapRecord(schema, + Collections.singletonMap( + "json_str", + "{\"firstName\":\"John\",\"age\":30,\"addresses\":[{\"address_1\":\"123 Fake Street\"}]}") + ); + // recursively convert Maps to Records (addresses becomes and ARRAY or RECORDs) + assertEquals( + DataTypeUtils.toRecord(new LinkedHashMap<String, Object>(){{ + put("firstName", "John"); + put("age", 30); + put("addresses", new Object[] {DataTypeUtils.toRecord(Collections.singletonMap("address_1", "123 Fake Street"), "addresses")}); + }}, "json_str"), Review Comment: Absolutely. The only problem is that `Map.of` doesn't provide deterministic ordering, so we do need to use `LinkedHasMap`s in some places, which I've changed to use the approach suggested. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org