json: Tighten and simplify qstring_from_escaped_str()'s loop