We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5726e82 commit 6c32736Copy full SHA for 6c32736
1 file changed
autoload/webapi/json.vim
@@ -65,6 +65,10 @@ endfunction
65
66
function! webapi#json#decode(json) abort
67
let json = iconv(a:json, "utf-8", &encoding)
68
+ if exists('*jsondecode')
69
+ " TODO: handle encoding if vim change the behavior
70
+ return jsondecode(json)
71
+ endif
72
if get(g:, 'webapi#json#parse_strict', 1) == 1 && substitute(substitute(substitute(
73
\ json,
74
\ '\\\%(["\\/bfnrt]\|u[0-9a-fA-F]\{4}\)', '\@', 'g'),
@@ -102,6 +106,9 @@ function! webapi#json#decode(json) abort
102
106
endfunction
103
107
104
108
function! webapi#json#encode(val) abort
109
+ if exists('*jsonencode')
110
+ return jsonencode(a:val)
111
105
112
if type(a:val) == 0
113
return a:val
114
elseif type(a:val) == 1
0 commit comments