Json parsing refactor

Fix for the issue #4