Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 53493200C6A for ; Wed, 19 Apr 2017 23:43:46 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 51C41160B94; Wed, 19 Apr 2017 21:43:46 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 994A0160B9C for ; Wed, 19 Apr 2017 23:43:45 +0200 (CEST) Received: (qmail 31111 invoked by uid 500); 19 Apr 2017 21:43:44 -0000 Mailing-List: contact issues-help@flex.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flex.apache.org Delivered-To: mailing list issues@flex.apache.org Received: (qmail 31102 invoked by uid 99); 19 Apr 2017 21:43:44 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 Apr 2017 21:43:44 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 716171857B2 for ; Wed, 19 Apr 2017 21:43:44 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.201 X-Spam-Level: X-Spam-Status: No, score=-99.201 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id 4XLlro9nYUDT for ; Wed, 19 Apr 2017 21:43:43 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 236A95FB64 for ; Wed, 19 Apr 2017 21:43:43 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 4B465E0D3A for ; Wed, 19 Apr 2017 21:43:42 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id A467221B51 for ; Wed, 19 Apr 2017 21:43:41 +0000 (UTC) Date: Wed, 19 Apr 2017 21:43:41 +0000 (UTC) From: "Piotr Zarzycki (JIRA)" To: issues@flex.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (FLEX-35297) JSON.stringify is not working with object marked by Bindable MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Wed, 19 Apr 2017 21:43:46 -0000 [ https://issues.apache.org/jira/browse/FLEX-35297?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Piotr Zarzycki updated FLEX-35297: ---------------------------------- Attachment: FlexJSJSONTest.zip Add example project, which contains compiled sources in folder: JS: target\javascript\bin\js-debug\ SWF: target\FlexJSTEst-0.8.0-SNAPSHOT.swf > JSON.stringify is not working with object marked by Bindable > ------------------------------------------------------------ > > Key: FLEX-35297 > URL: https://issues.apache.org/jira/browse/FLEX-35297 > Project: Apache Flex > Issue Type: Bug > Components: FlexJS > Affects Versions: Apache FlexJS 0.8.0, Apache FalconJX 0.8.0 > Reporter: Piotr Zarzycki > Assignee: Greg Dove > Attachments: book_js_with_bindable.png, FlexJSJSONTest.zip > > > FlexJS is using JSON.stringify to produce json from value objects. > Two general issues has been discovered during development: > 1) "stringify" function is not able to parse object which is marked by [Bindable] tag > *Description:* > In the attached example there is class Book which is marked by [Bindable] tag. During parsing we are getting stack trace: > {code} > Uncaught TypeError: Converting circular structure to JSON > at JSON.stringify () > {code} > This happened cause compiled VO object contains additional properties which "stringify" is not able to parse. (book_js_with_bindable.png) > > 2) there are differences between swf and js sight in results of parsing by "stringify" function > *JSON.stringify SWF:* > { > "authors":["Kitten","Puppy"], > "date":"Wed Apr 19 14:00:50 GMT-0500 2017", > "doNotHide":99, > "page":0, > "title":"Trump", > "topic":{"name":"Politics"}, > "dedication":"Lucy" > } > *JSON.stringify JS:* > { > "topic":{}, > "internalDate":"2017-04-19T21:30:27.959Z", > "title":"Trump", > "date":"2017-04-19T21:30:27.959Z", > "authors":["Kitten","Puppy"], > "_dedication":"Lucy" > } > *Expected results:* > 1) We should be able to parse object with [Bindable] tag without any issues > 2) SWF and JS stringify function should produce exact same json results. > *Proposition:* > - In order to avoid issues above VO should contains "toJSON" function. > Example class with toJSON function: > {code} > [Bindable] > public class Book > { > public var title:String; > public var page:int; > public var date:Date; > public var authors:Array; > public var topic:Topic = new Topic(); > public var doNotHide:uint = 99; > private var internalDate: Date = new Date(); > private var _dedication:String; > public function get dedication():String > { > return _dedication; > } > public function set dedication(value:String):void > { > _dedication = value; > } > public function toJSON(k:String):Object > { > return {title: title, > page: page, > date: date, > authors: authors, > topic: {name: topic.name}, > doNotHide: doNotHide, > internalDate: internalDate, > dedication: dedication}; > } > } > {code} -- This message was sent by Atlassian JIRA (v6.3.15#6346)