mirror of
https://github.com/hapifhir/org.hl7.fhir.core.git
synced 2025-03-02 09:29:13 +00:00
fix JsonUtils to handle null
This commit is contained in:
parent
977026e62e
commit
6ea5016da5
@ -28,6 +28,7 @@ import java.util.Map.Entry;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonNull;
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
public class JSONUtil {
|
||||
@ -73,7 +74,7 @@ public class JSONUtil {
|
||||
|
||||
public static String str(JsonObject json, String name) {
|
||||
JsonElement e = json.get(name);
|
||||
return e == null ? null : e.getAsString();
|
||||
return e == null || e instanceof JsonNull ? null : e.getAsString();
|
||||
}
|
||||
|
||||
public static String str(JsonObject json, String name1, String name2) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user