Use rootKey in toJSON if available
Merge pull request #85 from darthdeus/root-key-in-json

Use rootKey in toJSON if available