code: private String getHighlightedAttribute(@NonNull JSONObject result, String attribute,
                                             boolean inverted, boolean snippetted) {
          final JSONObject highlightResult = result.optJSONObject((snippetted ? "_snippet" : "_highlight") + "Result");
          if (highlightResult != null) {
              HashMap<String, String> highlightAttribute = JSONUtils.getMapFromJSONPath(highlightResult, attribute);
              if (highlightAttribute != null) {
                  String highlightedValue = highlightAttribute.get("value");
                  if (inverted) {
                      highlightedValue = inverseHighlight(highlightedValue);
                  }
                  if (highlightedValue != null) {
                      return highlightedValue;
                  }
              } else { //Maybe it is an array?
                  final JSONArray array = highlightResult.optJSONArray(attribute);
                  if (array != null) {
                      StringBuilder builder = new StringBuilder();
                      final int length = array.length();
  
                      for (int i = 0; i < length; i++) {
                          final String elementValue = ((JSONObject) array.opt(i)).optString("value");
                          builder.append(elementValue);
                          if (i + 1 < length) {
                              builder.append(", ");
                          }
                      }
                      return builder.toString();
                  }
              }
          }
          return JSONUtils.getStringFromJSONPath(result, attribute);
      }
docs: Gets the highlighted version of an attribute, if there is one.
  
  @param result     {@link JSONObject} describing a hit.
  @param attribute  the name of the attribute to return highlighted.
  @param inverted   if {@code true}, the highlighting will be inverted.
  @param snippetted if {@code true}, the snippetted value of the attribute will be used for highlighting.
  @return the highlighted version of this attribute if there is one, else the raw attribute.