FWIW, the doc implies there is no JSON class in FP 10.x. Do we care? -Alex ________________________________________ From: jmcl...@apache.org [jmcl...@apache.org] Sent: Sunday, February 23, 2014 4:22 PM To: comm...@flex.apache.org Subject: git commit: [flex-sdk] [refs/heads/develop] - FLEX-34108 add toJSON to ArrayCollection and ArrayList
Repository: flex-sdk Updated Branches: refs/heads/develop 6942969e4 -> 4cec69c5a FLEX-34108 add toJSON to ArrayCollection and ArrayList Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/4cec69c5 Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/4cec69c5 Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/4cec69c5 Branch: refs/heads/develop Commit: 4cec69c5a6d846c12bd52e08aa2dcdc416b7911d Parents: 6942969 Author: Justin Mclean <jmcl...@apache.org> Authored: Mon Feb 24 11:21:43 2014 +1100 Committer: Justin Mclean <jmcl...@apache.org> Committed: Mon Feb 24 11:21:43 2014 +1100 ---------------------------------------------------------------------- .../framework/src/mx/collections/ArrayCollection.as | 16 +++++++++++++++- .../framework/src/mx/collections/ArrayList.as | 14 ++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/4cec69c5/frameworks/projects/framework/src/mx/collections/ArrayCollection.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/framework/src/mx/collections/ArrayCollection.as b/frameworks/projects/framework/src/mx/collections/ArrayCollection.as index 850317b..9d6f18d 100644 --- a/frameworks/projects/framework/src/mx/collections/ArrayCollection.as +++ b/frameworks/projects/framework/src/mx/collections/ArrayCollection.as @@ -105,7 +105,7 @@ public class ArrayCollection extends ListCollectionView implements IExternalizab // Properties // //-------------------------------------------------------------------------- - + //---------------------------------- // source //---------------------------------- @@ -147,6 +147,20 @@ public class ArrayCollection extends ListCollectionView implements IExternalizab // //-------------------------------------------------------------------------- + /** + * Converts an Array Collection to JavaScript Object Notation (JSON) format. + * + * @langversion 3.0 + * @playerversion Flash 11 + * @playerversion AIR 3.0 + * @productversion Apache Flex 4.12 + */ + public function toJSON(s:String):* + { + var array:Array = toArray(); + return JSON.stringify(array); + } + /** * @private * Ensures that only the source property is serialized. http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/4cec69c5/frameworks/projects/framework/src/mx/collections/ArrayList.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/framework/src/mx/collections/ArrayList.as b/frameworks/projects/framework/src/mx/collections/ArrayList.as index 1afa845..abdb09b 100644 --- a/frameworks/projects/framework/src/mx/collections/ArrayList.as +++ b/frameworks/projects/framework/src/mx/collections/ArrayList.as @@ -271,6 +271,20 @@ public class ArrayList extends EventDispatcher // //-------------------------------------------------------------------------- + /** + * Converts an Array Collection to JavaScript Object Notation (JSON) format. + * + * @langversion 3.0 + * @playerversion Flash 11 + * @playerversion AIR 3.0 + * @productversion Apache Flex 4.12 + */ + public function toJSON(s:String):* + { + var array:Array = toArray(); + return JSON.stringify(array); + } + /** * Get the item at the specified index. *