JSON serialization code refactoring
Merge pull request #412 from lev-kuznetsov/master

JSON serialization code refactoring