Fixes Issue #1581; caused by assumption that type is null.
Merge pull request #511 from methius/bug-1581-jsonTypeNPE

Fixes Issue #1581; caused by assumption that type is null.