| Constructor and Description |
|---|
JSONUtil() |
| Modifier and Type | Method and Description |
|---|---|
static String |
extractTopLevelFieldValue(String json,
String fieldName)
Efficiently extracts the raw text value of a top-level field from a JSON object
without full parsing.
|
static String |
extractTopLevelStringField(String json,
String fieldName)
Efficiently extracts a top-level string field value from a JSON object
without full parsing.
|
public JSONUtil()
public static String extractTopLevelStringField(String json, String fieldName)
null if the field is not found or its value is not a string.
This avoids the cost of building a full object tree via
JSON.parseObject() when only a few top-level fields are needed.
public static String extractTopLevelFieldValue(String json, String fieldName)
null if the field is not found.
For string values, the surrounding quotes are stripped. For all other value types (number, boolean, null), the raw text is returned as-is.