Skip to content

Commit b7e8923

Browse files
committed
Tune up JSON parser. replace substitute to split/join
1 parent 5ceaded commit b7e8923

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

autoload/webapi/json.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ function! webapi#json#decode(json)
7373
\ '\%(^\|:\|,\)\%(\s*\[\)\+', '', 'g') !~ '^[\],:{} \t\n]*$'
7474
throw json
7575
endif
76-
let json = substitute(json, '\n', '', 'g')
76+
let json = join(split(json, "\n"), "")
7777
let json = substitute(json, '\\x22\|\\u0022', '\\"', 'g')
7878
if v:version >= 703 && has('patch780')
7979
let json = substitute(json, '\\u\(\x\x\x\x\)', '\=iconv(nr2char(str2nr(submatch(1), 16), 1), "utf-8", &encoding)', 'g')

0 commit comments

Comments
 (0)