public void SettingsTest() { var settings = new JsonInterfaceSettings().JsonSerializerSettings; settings.ContractResolver = new CamelCasePropertyNamesContractResolver(); var serializer = JsonSerializer.Create(settings); var contract = serializer.ContractResolver.ResolveContract(typeof(IMyType)); var contract2 = serializer.ContractResolver.ResolveContract(typeof(List <int>)); var properties = ((JsonObjectContract)contract).Properties; var myProperties = properties .Select(v => new { v.PropertyName, v.UnderlyingName }) .ToDictionary(v => v.UnderlyingName, v => v.PropertyName); var reverseDictionary = myProperties.ToDictionary(v => v.Value, v => v.Key); }
public JToken ToToken(T value, JsonInterfaceSettings settings) { throw new NotImplementedException(NotSupportedErrorMessage); }
public static IWriteJsonTypeHandler <T> GetWriteJsonTypeHandler(JsonInterfaceSettings settings) => settings.TrapExceptions ? _exceptionCatchingHandler : _writeJsonTypeHandler;
internal static JsonInterfaceSettings DefaultIfNull(this JsonInterfaceSettings settings) => settings ?? JsonInterfaceSettings.DefaultSettings;
public static IReadJsonTypeHandler <T> GetReadJsonTypeHandler(JsonInterfaceSettings settings) => settings.TrapExceptions ? _exceptionCatchingHandler : _readJsonTypeHandler;