Class JsonObj

java.lang.Object
org.opencastproject.util.JsonObj

public final class JsonObj extends Object
Accessor for JSON objects aka maps.
  • Constructor Details

    • JsonObj

      public JsonObj(Map json)
      Create a wrapper for a map.
  • Method Details

    • jsonObj

      public static JsonObj jsonObj(Map json)
      Constructor function.
    • jsonObj

      public static JsonObj jsonObj(String json)
      Create a JsonObj from a JSON string.
    • keySet

      public Set keySet()
    • val

      public JsonVal val(String key)
    • obj

      public JsonObj obj(String key)
    • arr

      public JsonArr arr(String key)
    • has

      public boolean has(String key)
    • get

      public <A> A get(Class<A> ev, String key)
      Deprecated.
      Get mandatory value of type ev.
      Returns:
      the requested value if it exists and has the required type
    • opt

      public <A> Optional<A> opt(Class<A> ev, String key)
      Deprecated.
      Get optional value of type ev.
      Returns:
      some if the value exists and has the required type, none otherwise
    • getObj

      public JsonObj getObj(String key)
      Deprecated.
      Get mandatory JSON object.
    • optObj

      public Optional<JsonObj> optObj(String key)
      Deprecated.
      Get an optional JSON object.