Fixed bug with JSON after refactor