New json encoding implementation to resolve issue #25