Github user ottobackwards commented on a diff in the pull request:
https://github.com/apache/metron/pull/727#discussion_r138314713
--- Diff:
metron-stellar/stellar-common/src/main/java/org/apache/metron/stellar/dsl/functions/StringFunctions.java
---
@@ -550,4 +548,90 @@ else if(var.length() == 0) {
return new ParseException("Unable to parse JSON string");
}
}
+
+ @Stellar(name = "JSON_TO_MAP"
+ , description = "Returns a MAP object for the specified JSON
string"
+ , params = {
+ "str - the JSON String to convert, may be null"
+ }
+ , returns = "a MAP object containing the parsed JSON string"
+ )
+ public static class JsonToMap extends BaseStellarFunction {
+
+ @Override
+ public Object apply(List<Object> strings) {
+
+ if (strings == null || strings.size() == 0) {
+ throw new IllegalArgumentException("[JSON_TO_MAP] incorrect
arguments. Usage: JSON_TO_MAP <JSON String>");
+ }
--- End diff --
instanceof string
---