We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3448c39 commit c7eec04Copy full SHA for c7eec04
1 file changed
autoload/webapi/json.vim
@@ -25,8 +25,26 @@ function! webapi#json#decode(json) abort
25
return json_decode(a:json)
26
endfunction
27
28
+function! s:convert_funcrefs(val) abort
29
+ if type(a:val) == 2
30
+ let s = string(a:val)
31
+ if s == "function('webapi#json#null')"
32
+ return v:null
33
+ elseif s == "function('webapi#json#true')"
34
+ return v:true
35
+ elseif s == "function('webapi#json#false')"
36
+ return v:false
37
+ endif
38
+ elseif type(a:val) == 3
39
+ return map(copy(a:val), 's:convert_funcrefs(v:val)')
40
+ elseif type(a:val) == 4
41
42
43
+ return a:val
44
+endfunction
45
+
46
function! webapi#json#encode(val) abort
- return json_encode(a:val)
47
+ return json_encode(s:convert_funcrefs(a:val))
48
49
50
else
0 commit comments