Class JsonFunctions.JsonPath

java.lang.Object
org.apache.juneau.commons.svl.TypedFunction
org.apache.juneau.commons.svl.functions.JsonFunctions.JsonPath
All Implemented Interfaces:
VarFunction
Enclosing class:
JsonFunctions

public static class JsonFunctions.JsonPath extends TypedFunction
#{jsonPath(json, path)} / #{jsonPath(json, path, default)} — extracts a value via a slash-rooted path (e.g. "/data/0/name").

Returns the matched value as a String (objects/arrays serialize back to JSON). Missing path returns "" for the two-arg form, or default for the three-arg form.

  • Constructor Details

  • Method Details

    • name

      public String name()
      Description copied from interface: VarFunction
      The function's invocation name as it appears between #{} and the opening parenthesis in the template. Must consist of ASCII letters, digits, and underscores; must begin with a letter.
      Returns:
      The invocation name. Never null or empty.
    • invoke

      public String invoke(String json, String path)
    • invoke

      public String invoke(String json, String path, String defaultValue)