Class JsonUtils
java.lang.Object
co.ankatech.ankasecure.sdk.internal.util.JsonUtils
Thread-safe JSON helper with a single, shared
ObjectMapper.
The mapper is tuned for human-readable output:
- Pretty printed (two-space indentation).
- ISO-8601 date/time serialisation via
JavaTimeModule. - Timestamps disabled – epoch millis are never written.
nullexclusion – properties with anullvalue are silently omitted from the JSON payload to keep the output succinct and to avoid confusion on the consumer side.
- Since:
- 2.1.0
- Author:
- ANKATech – Security Engineering
-
Method Summary
-
Method Details
-
toJson
Serialisesobjto a JSON string.- Parameters:
obj- arbitrary Java object- Returns:
- canonical JSON representation (never
null) - Throws:
RuntimeException- if Jackson fails to serialise
-
fromJson
Deserialises the supplied JSON intotype.- Type Parameters:
T- generic type parameter- Parameters:
json- non-null JSON stringtype- target class- Returns:
- fully populated instance of
type - Throws:
RuntimeException- if Jackson fails to deserialise
-