handle json same way as as

Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/22c78cef
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/22c78cef
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/22c78cef

Branch: refs/heads/develop
Commit: 22c78cef611ce88456487f41308d3e97d9a4a3bc
Parents: 1a48296
Author: Alex Harui <[email protected]>
Authored: Mon Dec 22 23:37:59 2014 -0800
Committer: Alex Harui <[email protected]>
Committed: Mon Dec 22 23:37:59 2014 -0800

----------------------------------------------------------------------
 .../js/FlexJS/src/org/apache/flex/net/JSONItemConverter.js    | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/22c78cef/frameworks/js/FlexJS/src/org/apache/flex/net/JSONItemConverter.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/net/JSONItemConverter.js 
b/frameworks/js/FlexJS/src/org/apache/flex/net/JSONItemConverter.js
index b0c8146..3ef832c 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/net/JSONItemConverter.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/net/JSONItemConverter.js
@@ -39,5 +39,10 @@ 
org.apache.flex.net.JSONItemConverter.prototype.FLEXJS_CLASS_INFO =
  * @return {*} The object.
  */
 org.apache.flex.net.JSONItemConverter.prototype.convertItem = function(s) {
-  return JSON.parse(s + '}');
+  var c = s.indexOf('{)');
+  if (c > 0)
+    s = s.substring(c);
+  if (s.indexOf('}') == -1)
+    s += '}';
+  return JSON.parse(s);
 };

Reply via email to