Fixing JSON rest endpoint