Problem: Error E937 is used both for duplicate key in JSON and for trying
to delete a buffer that is in use.
Solution: Rename the JSON error to E938. (Norio Takagi, closes#1376)
Problem: JSON with a duplicate key gives an internal error. (Lcd)
Solution: Give a normal error. Avoid an error when parsing JSON from a
remote client fails.
Problem: Using the system default encoding makes tests unpredictable.
Solution: Always use utf-8 or latin1 in the new style tests. Remove setting
encoding and scriptencoding where it is not needed.
Problem: Json encoding still fails when encoding is not utf-8.
Solution: Set 'encoding' before :scriptencoding. Run the json test
separately to avoid affecting other tests.
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.
Problem: json_encode() does not handle NaN and inf properly. (David
Barnett)
Solution: For JSON turn them into "null". For JS use "NaN" and "Infinity".
Add isnan().
Problem: Function names are difficult to read.
Solution: Rename jsonencode to json_encode, jsondecode to json_decode,
jsencode to js_encode and jsdecode to js_decode.
Problem: Can't encode a Funcref into JSON. jsonencode() doesn't handle the
same list or dict twice properly. (Nikolay Pavlov)
Solution: Give an error. Reset copyID when the list or dict is finished.
Problem: No tests for comparing special variables. Error in jsondecode()
not reported. test_json does not work Japanse system.
Solution: Set scriptencoding. (Ken Takata) Add a few more tests. Add error.