[utils] Improve comments processing in js_to_json (closes #11947)