Class JsonHelpers

java.lang.Object
edu.suffolk.litlab.efspserver.JsonHelpers

public class JsonHelpers extends Object
  • Constructor Details

    • JsonHelpers

      public JsonHelpers()
  • Method Details

    • isNull

      public static boolean isNull(com.fasterxml.jackson.databind.JsonNode j)
    • getStringMember

      public static Optional<String> getStringMember(com.fasterxml.jackson.databind.JsonNode obj, String memberName)
    • getNonEmptyStringMember

      public static Optional<String> getNonEmptyStringMember(com.fasterxml.jackson.databind.JsonNode obj, String memberName)
    • getStringDefault

      public static String getStringDefault(com.fasterxml.jackson.databind.JsonNode obj, String memberName, String def)
    • getIntMember

      public static Optional<Integer> getIntMember(com.fasterxml.jackson.databind.JsonNode obj, String memberName)
    • getNumberMember

      public static Optional<BigDecimal> getNumberMember(com.fasterxml.jackson.databind.JsonNode obj, String memberName)
    • getBoolMember

      public static Optional<Boolean> getBoolMember(com.fasterxml.jackson.databind.JsonNode obj, String memberName)
    • getMemberList

      public static List<String> getMemberList(com.fasterxml.jackson.databind.JsonNode obj, String memberName)
    • unwrapDAList

      public static Optional<com.fasterxml.jackson.databind.JsonNode> unwrapDAList(com.fasterxml.jackson.databind.JsonNode obj)
      Returns the JsonNode where `.isArray()` is true.

      For DAList objects, Docassemble puts the actual JSON array nested in the `elements` attribute. This function lets you treat a normal JSON array and a DAList JSON object the same.

    • unwrapDADict

      public static Optional<com.fasterxml.jackson.databind.JsonNode> unwrapDADict(com.fasterxml.jackson.databind.JsonNode obj)