Restored JSON reimplementation