yixiaohui12345 / as3corelib

Automatically exported from code.google.com/p/as3corelib
1 stars 0 forks source link

Use "valueOf()" to customize JSON object #137

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.
2.
3.

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?

Please provide any additional information below.
Sometimes we need to minimize the memory size of informations. When using
JSON on an object, we should be able to specify only the properties we want
to serialize.

There is a function on the "Object" class called "valueOf()". By default it
returns the object itself. But we can implement it in our object class to
return a custom object.

To do that, just add the line "value = value.valueOf()" at the begining of
the function "ConvertToString" of the "JSONEncoder" class.

Thanks,
Tontonpiero <martin.pierre38@gmail.com>

Original issue reported on code.google.com by martin.p...@gmail.com on 10 Feb 2010 at 2:21