Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for marshalling JSON #383

Open
GoogleCodeExporter opened this issue Aug 21, 2015 · 1 comment
Open

Add support for marshalling JSON #383

GoogleCodeExporter opened this issue Aug 21, 2015 · 1 comment

Comments

@GoogleCodeExporter
Copy link

Could vim have a built-in tojson({value}) and fromjson({json}) helpers to 
serialize and deserialize JSON?

JSON is used in lots of vim plugins like 
https://github.com/Valloric/YouCompleteMe, 
https://github.com/google/vim-maktaba, 
https://github.com/MarcWeber/vim-addon-manager, and eventually Vundle 
(https://github.com/VundleVim/Vundle.vim/pull/560). These can either use slow 
hacks or depend on python support, but it would be best if vim just had native, 
performant support for JSON marshalling built in.

Expected behavior
  :echo tojson({'a': [1, 'foo'], 'b': 2.1}) ==# '{"a": [1, "foo"], "b": 2.1}'
  1
  :echo fromjson("[1.0, {}, []]") ==# [1.0, {}, []]
  1
  :echo tojson(fromjson('[null, true, false]')) ==# '[null, true, false]'
  1

Note in the last example there needs to be a way to represent null, true, and 
false unambiguously even though vim doesn't have these primitives. Also, 
fromjson() could use an option to translate into standard vim equivalents like 
'', 1, and 0.

Original issue reported on code.google.com by [email protected] on 13 Jul 2015 at 11:30

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant