No parameterless constructor defined for type of ‘System.String’ during JSON deserialization

Parameterless constructors need for any kind of deserialization. Imagine that you are implementing a deserializer. You need to: Get a type of object from the input stream (in this case it’s string) Instantiate the object. You have no way to do that if there is no default constructor. Read the properties/value from stream Assign the … Read more

SignalR : use camel case

Roll your own Conttract resolver like public class SignalRContractResolver : IContractResolver { private readonly Assembly assembly; private readonly IContractResolver camelCaseContractResolver; private readonly IContractResolver defaultContractSerializer; public SignalRContractResolver() { defaultContractSerializer = new DefaultContractResolver(); camelCaseContractResolver = new CamelCasePropertyNamesContractResolver(); assembly = typeof(Connection).Assembly; } public JsonContract ResolveContract(Type type) { if (type.Assembly.Equals(assembly)) { return defaultContractSerializer.ResolveContract(type); } return camelCaseContractResolver.ResolveContract(type); } } Register … Read more

Deserialize millisecond timestamp to java.time.Instant

Solution was to add .configure(DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS, false) to the ObjectMapper. Complete ObjectMapper looks like: ObjectMapper om = new ObjectMapper() .registerModule(new JavaTimeModule()) .configure(SerializationFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS, false) .configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false) .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false) .configure(DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS, false) .setSerializationInclusion(Include.NON_NULL);

How to resolve deserialization error in delayed job?

It’s not really a deserialization error, it’s an ActiveRecord record-not-found error on a simple Model.find(id) query. If you want to know the details, log them in the delayed_job-2.1.3/lib/delayed/serialization/active_record.rb file, in the rescue statement, just before delayed-job stupidly raises the DeserializationError and throws the useful information away.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)