All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.opentripplanner.framework.json.JsonUtils Maven / Gradle / Ivy

The newest version!
package org.opentripplanner.framework.json;

import com.fasterxml.jackson.databind.JsonNode;
import java.util.Optional;

public class JsonUtils {

  public static Optional asText(JsonNode node, String field) {
    JsonNode valueNode = node.get(field);
    if (valueNode == null) {
      return Optional.empty();
    }
    String value = valueNode.asText();
    return value.isEmpty() ? Optional.empty() : Optional.of(value);
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy