search-engine.js: fix bug in JSON completion code