/JsonDuckTyper

Extension method for Newtonsoft to allow JObjects to behave like a specific interface (Duck Typing)

Primary LanguageC#MIT LicenseMIT

JsonDuckTyper

This is a simple extension method for Newtonsoft to allow JObjects to behave like a specific interface (Duck Typing)

A little bit more info here: https://stackoverflow.com/questions/5780888/casting-interfaces-for-deserialization-in-json-net/45646664#45646664

and here: http://www.lighthouselogic.com/deserialize-json-to-interface-without-concrete-class/

It's definitely a work in progress but you can see what's supported by looking at the tests.

If you find something that is not supported, create a test for it and the code and send me a pull request.

It's been published on nuget for convenience.