Class StringEscapeUtils
java.lang.Object
io.micrometer.core.instrument.util.StringEscapeUtils
Utilities for JSON escaping
String.
Implementation Approach
This uses a replacement char array to perform escaping, an idea from Square/Moshi. In their case, it was an internal detail ofcom.squareup.moshi.JsonUtf8Writer, licensed Apache 2.0 Copyright 2010 Google
Inc. The comments and initialization of REPLACEMENT_CHARS came directly from
Moshi's JsonUtf8Writer.-
Method Summary
-
Method Details
-
escapeJson
- Parameters:
v- The string to escape.- Returns:
- An escaped JSON string.
-