You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@metron.apache.org by cestella <gi...@git.apache.org> on 2017/09/01 14:57:29 UTC

[GitHub] metron pull request #727: METRON-1146: Add ability to parse JSON string into...

Github user cestella commented on a diff in the pull request:

    https://github.com/apache/metron/pull/727#discussion_r136594535
  
    --- Diff: metron-stellar/stellar-common/src/main/java/org/apache/metron/stellar/dsl/functions/StringFunctions.java ---
    @@ -450,4 +454,40 @@ public Object apply(List<Object> strings) {
         }
       }
     
    +  @Stellar( name = "PARSE_JSON_STRING"
    +          , description = "Returns a JSON object for the specified JSON string"
    +          , params = {
    +            "str - the JSON String to convert, may be null"
    +          }
    +          , returns = "an Object containing the parsed JSON string"
    +  )
    +  public static class ParseJsonString extends BaseStellarFunction {
    +
    --- End diff --
    
    So, the usecase is having an enrichment which stores a JSON blob in HBase (or some other store) that you want to marshall into a Java object to interact with via stellar.  Some people would prefer to have their data in a readable format rather than serialized via kryo (like we do in the profiler) or restricted to a certain format (like we do in enrichments).  This opens up those use-cases.
    
    That JSON blob may be a map or a list or a primitive; the idea is to let jackson handle the parsing of it, so the bounds are what JSON can represent.  The knowledge of what is returned would be necessary for the caller, though, as you say.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---