improve json functionality in model