GH-745 Ensure RSocket support is ready to receive non-Message

This commit is contained in:
Oleg Zhurakousky
2021-09-22 17:24:37 +02:00
parent 6aafea1537
commit d7ef882ca5
2 changed files with 35 additions and 3 deletions

View File

@@ -158,4 +158,16 @@ public abstract class JsonMapper {
}
return isJson;
}
public static boolean isJsonStringRepresentsMap(Object value) {
boolean isJson = false;
if (value instanceof byte[]) {
value = new String((byte[]) value, StandardCharsets.UTF_8);
}
if (value instanceof String) {
String str = ((String) value).trim();
isJson = isJsonString(value) && str.startsWith("{") && str.endsWith("}");
}
return isJson;
}
}