Mercurial > vim
comparison runtime/doc/eval.txt @ 8275:ff900e499f79 v7.4.1430
commit https://github.com/vim/vim/commit/7ce686c990ea8c490d16be7f1c6bd95eb48816f9
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Feb 27 16:33:22 2016 +0100
patch 7.4.1430
Problem: When encoding JSON, turning NaN and Infinity into null without
giving an error is not useful.
Solution: Pass NaN and Infinity on. If the receiver can't handle them it
will generate the error.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 27 Feb 2016 16:45:04 +0100 |
parents | 989ac3aed1ef |
children | e05e28dcb590 |
comparison
equal
deleted
inserted
replaced
8274:fbf8242df3a4 | 8275:ff900e499f79 |
---|---|
1 *eval.txt* For Vim version 7.4. Last change: 2016 Feb 23 | 1 *eval.txt* For Vim version 7.4. Last change: 2016 Feb 27 |
2 | 2 |
3 | 3 |
4 VIM REFERENCE MANUAL by Bram Moolenaar | 4 VIM REFERENCE MANUAL by Bram Moolenaar |
5 | 5 |
6 | 6 |
4559 The encoding is specified in: | 4559 The encoding is specified in: |
4560 https://tools.ietf.org/html/rfc7159.html | 4560 https://tools.ietf.org/html/rfc7159.html |
4561 Vim values are converted as follows: | 4561 Vim values are converted as follows: |
4562 Number decimal number | 4562 Number decimal number |
4563 Float floating point number | 4563 Float floating point number |
4564 Float nan "NaN" | |
4565 Float inf "Infinity" | |
4564 String in double quotes (possibly null) | 4566 String in double quotes (possibly null) |
4565 Funcref not possible, error | 4567 Funcref not possible, error |
4566 List as an array (possibly null); when | 4568 List as an array (possibly null); when |
4567 used recursively: [] | 4569 used recursively: [] |
4568 Dict as an object (possibly null); when | 4570 Dict as an object (possibly null); when |
4569 used recursively: {} | 4571 used recursively: {} |
4570 v:false "false" | 4572 v:false "false" |
4571 v:true "true" | 4573 v:true "true" |
4572 v:none "null" | 4574 v:none "null" |
4573 v:null "null" | 4575 v:null "null" |
4574 Note that using v:none is permitted, although the JSON | 4576 Note that NaN and Infinity are passed on as values. This is |
4575 standard does not allow empty items. This can be useful for | 4577 missing in the JSON standard, but several implementations do |
4576 omitting items in an array: | 4578 allow it. If not then you will get an error. |
4577 [0,,,,,5] ~ | |
4578 This is much more efficient than: | |
4579 [0,null,null,null,null,5] ~ | |
4580 But a strict JSON parser will not accept it. | |
4581 | 4579 |
4582 keys({dict}) *keys()* | 4580 keys({dict}) *keys()* |
4583 Return a |List| with all the keys of {dict}. The |List| is in | 4581 Return a |List| with all the keys of {dict}. The |List| is in |
4584 arbitrary order. | 4582 arbitrary order. |
4585 | 4583 |