in Source/Assets/AppCenterEditorExtensions/Editor/Scripts/AppCenterEditorSDK/SimpleJson.cs [1019:1073]
static bool SerializeValue(IJsonSerializerStrategy jsonSerializerStrategy, object value, StringBuilder builder)
{
bool success = true;
string stringValue = value as string;
if (value == null)
builder.Append("null");
else if (stringValue != null)
success = SerializeString(stringValue, builder);
else
{
IDictionary<string, object> dict = value as IDictionary<string, object>;
Type type = value.GetType();
Type[] genArgs = ReflectionUtils.GetGenericTypeArguments(type);
#if NETFX_CORE
var isStringKeyDictionary = type.GetTypeInfo().IsGenericType && type.GetGenericTypeDefinition() == typeof(Dictionary<,>) && genArgs[0] == typeof(string);
#else
var isStringKeyDictionary = type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Dictionary<,>) && genArgs[0] == typeof(string);
#endif
if (isStringKeyDictionary)
{
var strDictValue = value as IDictionary;
success = SerializeObject(jsonSerializerStrategy, strDictValue.Keys, strDictValue.Values, builder);
}
else if (dict != null)
{
success = SerializeObject(jsonSerializerStrategy, dict.Keys, dict.Values, builder);
}
else
{
IDictionary<string, string> stringDictionary = value as IDictionary<string, string>;
if (stringDictionary != null)
{
success = SerializeObject(jsonSerializerStrategy, stringDictionary.Keys, stringDictionary.Values, builder);
}
else
{
IEnumerable enumerableValue = value as IEnumerable;
if (enumerableValue != null)
success = SerializeArray(jsonSerializerStrategy, enumerableValue, builder);
else if (IsNumeric(value))
success = SerializeNumber(value, builder);
else if (value is bool)
builder.Append((bool)value ? "true" : "false");
else
{
object serializedObject;
success = jsonSerializerStrategy.TrySerializeNonPrimitiveObject(value, out serializedObject);
if (success)
SerializeValue(jsonSerializerStrategy, serializedObject, builder);
}
}
}
}
return success;
}