fix typo in model and add json representation
refactor to use json models instead of clumpy php models