toJSONString method doesn't work with arrays.
It returns [undefined]
with (new byte(0xFF)).toJSONStriong() returns an empty object (double variables as well), while with (new String("test")).toJSONString() it works as expected.
The same if you try
var b:byte = 0x01;
b; // 1
b.toJSONString(); // {}
Boolean, Number, int, uint, Object, Date and some other.
functions has different behaviours, probably this is expected.
A function.toJSONString() is an empty object.
A function with public "static" variables, with toJSONString() return an object with its public "static" values.
ECMAScript Edition 4 RI v0.0M2 (Tue Feb 12 14:20:55 2008)
>> var f:Function = function(){};
>> f.a = "b";
b
>> f.toJSONString();
{"a":"b"}
>> f.b = function(){};
[function Function]
>> f.b();
>> f.toJSONString();
[locn] c:\Documents and Settings\dherman\My Documents\ES4Model\builtins\Error.es
:85:55-85.55
[stack] [toJSONString() | formatObject([function Function], false) | fmtObject([
function Function]) | fmtFields([function Function], 2) | activate([function Fun
ction]) | deactivate([function Function]) | slice(0, 1) | init step()]
**ERROR** EvalError: uncaught exception: TypeError: incompatible types w/o conve
rsion: val=undefined type=undefined wanted=(byte|int|uint|double|decimal|Number)
(near c:\Documents and Settings\dherman\My Documents\ES4Model\builtins\Error.es
:85:55-85.55)
decimal.toJSONString() kill my shell (Windows XP full updated)
ECMAScript Edition 4 RI v0.0M2 (Tue Feb 12 14:20:55 2008)
>> var d:decimal = 1.2;
>> d
1.2
>> d.toJSONString(); // bye bye