JsonSerializer - DataDog/dd-sdk-android GitHub Wiki

object JsonSerializer

Functions

safeMapValuesToJson

fun Map<String, Any?>.safeMapValuesToJson(internalLogger: InternalLogger): Map<String, JsonElement>

This method will convert all values to JSON in a safe way, meaning if serialization fails for the particular value, the process will continue and faulty value will be dropped.

toJsonElement

fun toJsonElement(item: Any?): JsonElement

Converts arbitrary object to the JsonElement with the best effort. Any.toString is used as a fallback.