Package io.jans.configapi.core.util
Class Jackson
- java.lang.Object
-
- io.jans.configapi.core.util.Jackson
-
public class Jackson extends Object
- Author:
- Yuriy Zabrovarnyy
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> T
applyJsonPatch(com.github.fge.jsonpatch.JsonPatch jsonPatch, T obj)
static <T> T
applyPatch(com.github.fge.jsonpatch.JsonPatch jsonPatch, T obj)
static <T> T
applyPatch(String patchAsString, T obj)
static String
asJson(Object obj)
static com.fasterxml.jackson.databind.JsonNode
asJsonNode(String objAsString)
static String
asPrettyJson(Object obj)
static org.json.JSONObject
convertObjectToJsonObject(Object obj)
static com.fasterxml.jackson.databind.ObjectMapper
createJsonMapper()
static org.json.JSONObject
createJSONObject(Map<String,Object> map)
static String
getElement(String jsonString, String fieldName)
static com.github.fge.jsonpatch.JsonPatch
getJsonPatch(String patchAsString)
static <T> String
getJsonString(T obj)
static <T> T
getObject(String jsonString, T obj)
static boolean
isValidJson(Object obj)
static boolean
isValidJson(String json)
static <T> T
read(InputStream inputStream, T obj)
-
-
-
Method Detail
-
asJsonNode
public static com.fasterxml.jackson.databind.JsonNode asJsonNode(String objAsString) throws com.fasterxml.jackson.core.JsonProcessingException
- Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
getElement
public static String getElement(String jsonString, String fieldName) throws com.fasterxml.jackson.core.JsonProcessingException
- Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
applyPatch
public static <T> T applyPatch(String patchAsString, T obj) throws com.github.fge.jsonpatch.JsonPatchException, IOException
- Throws:
com.github.fge.jsonpatch.JsonPatchException
IOException
-
getJsonPatch
public static com.github.fge.jsonpatch.JsonPatch getJsonPatch(String patchAsString) throws com.github.fge.jsonpatch.JsonPatchException, IOException
- Throws:
com.github.fge.jsonpatch.JsonPatchException
IOException
-
applyJsonPatch
public static <T> T applyJsonPatch(com.github.fge.jsonpatch.JsonPatch jsonPatch, T obj) throws com.github.fge.jsonpatch.JsonPatchException, IOException
- Throws:
com.github.fge.jsonpatch.JsonPatchException
IOException
-
applyPatch
public static <T> T applyPatch(com.github.fge.jsonpatch.JsonPatch jsonPatch, T obj) throws com.github.fge.jsonpatch.JsonPatchException, com.fasterxml.jackson.core.JsonProcessingException
- Throws:
com.github.fge.jsonpatch.JsonPatchException
com.fasterxml.jackson.core.JsonProcessingException
-
read
public static <T> T read(InputStream inputStream, T obj) throws IOException
- Throws:
IOException
-
getObject
public static <T> T getObject(String jsonString, T obj) throws IOException
- Throws:
IOException
-
createJsonMapper
public static com.fasterxml.jackson.databind.ObjectMapper createJsonMapper()
-
getJsonString
public static <T> String getJsonString(T obj) throws IOException
- Throws:
IOException
-
asJson
public static String asJson(Object obj) throws IOException
- Throws:
IOException
-
asPrettyJson
public static String asPrettyJson(Object obj) throws IOException
- Throws:
IOException
-
createJSONObject
public static org.json.JSONObject createJSONObject(Map<String,Object> map) throws org.json.JSONException
- Throws:
org.json.JSONException
-
isValidJson
public static boolean isValidJson(String json)
-
isValidJson
public static boolean isValidJson(Object obj)
-
convertObjectToJsonObject
public static org.json.JSONObject convertObjectToJsonObject(Object obj) throws com.fasterxml.jackson.core.JsonProcessingException
- Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
-