json refactoring
Merge pull request #1522 from WalterBright/b21

json refactoring