json api: fix building of catalog.json (NB: this puts extra load on server; we can try to make it lighter)