Extension method for Newtonsoft to allow JObjects to behave like a specific interface (Duck Typing)
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
JsonDuckTyper
JsonDuckTyperTests
.gitattributes
.gitignore
JsonDuckTyper.sln
LICENSE
README.md

README.md

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.