Revert "refactoring to avoid duplication in variable names when converting to json"

This reverts commit e76a7599c69baa3119e040021842b7ed527b144e.