1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-24 09:40:06 +08:00
SpaceVim/lua/spacevim/api/data/json.lua
2022-01-03 16:30:05 +08:00

45 lines
729 B
Lua

local M = {}
-- should use local val
local fn = nil
if vim.fn == nil then
fn = require('spacevim').fn
else
fn = vim.fn
end
-- M._vim = require('spacevim.api').import('vim')
-- M._iconv = require('spacevim.api').import('iconv')
function M._json_null()
return nil
end
function M._json_true()
return true
end
function M._json_false()
return false
end
if fn.exists('*json_decode') then
function M.json_decode(json)
if json == '' then
return ''
end
return fn.json_decode(json)
end
else
end
if fn.exists('*json_encode') then
function M.json_encode(val)
return fn.json_encode(val)
end
else
end
return M