[Zorba-coders] [Bug 920717] Re: json 2.0 bug: json:serialize(json:parse(VALID_JSON))
** Changed in: zorba Status: Fix Committed = Fix Released -- You received this bug notification because you are a member of Zorba Coders, which is the registrant for Zorba. https://bugs.launchpad.net/bugs/920717 Title: json 2.0 bug: json:serialize(json:parse(VALID_JSON)) Status in Zorba - The XQuery Processor: Fix Released Bug description: Should be possible to call json:serialize(json:parse(VALID_JSON)) where VALID_JSON is any valid JSON string see added failing test test/rbkt/zorba/json/json-snelson-serialize-parse: import module namespace json=http://www.zorba-xquery.com/modules/converters/json;; declare variable $json-value := '{html:bbold/b}'; json:serialize(json:parse($json-value)) To manage notifications about this bug go to: https://bugs.launchpad.net/zorba/+bug/920717/+subscriptions -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Bug 920717] Re: json 2.0 bug: json:serialize(json:parse(VALID_JSON))
The following query: import module namespace json = http://www.zorba-xquery.com/modules/converters/json;; let $json := doc(tweet.json) return json:serialize($json) Where tweet.json is the result from json:parse() (the file is attached). Returns: json.xq:196,3: JSON serialization error [zerr:ZJSE0007]: JSON type object can not have a child text node = json:serialize#1 http://www.zorba-xquery.com/modules/converters/json ** Attachment added: tweet.json https://bugs.launchpad.net/zorba/+bug/920717/+attachment/2729288/+files/tweet.json -- You received this bug notification because you are a member of Zorba Coders, which is the registrant for Zorba. https://bugs.launchpad.net/bugs/920717 Title: json 2.0 bug: json:serialize(json:parse(VALID_JSON)) Status in Zorba - The XQuery Processor: In Progress Bug description: Should be possible to call json:serialize(json:parse(VALID_JSON)) where VALID_JSON is any valid JSON string see added failing test test/rbkt/zorba/json/json-snelson-serialize-parse: import module namespace json=http://www.zorba-xquery.com/modules/converters/json;; declare variable $json-value := '{html:bbold/b}'; json:serialize(json:parse($json-value)) To manage notifications about this bug go to: https://bugs.launchpad.net/zorba/+bug/920717/+subscriptions -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Bug 920717] Re: json 2.0 bug: json:serialize(json:parse(VALID_JSON))
** Changed in: zorba Status: Fix Committed = In Progress ** Changed in: zorba Assignee: William Candillon (wcandillon) = Paul J. Lucas (paul-lucas) -- You received this bug notification because you are a member of Zorba Coders, which is the registrant for Zorba. https://bugs.launchpad.net/bugs/920717 Title: json 2.0 bug: json:serialize(json:parse(VALID_JSON)) Status in Zorba - The XQuery Processor: In Progress Bug description: Should be possible to call json:serialize(json:parse(VALID_JSON)) where VALID_JSON is any valid JSON string see added failing test test/rbkt/zorba/json/json-snelson-serialize-parse: import module namespace json=http://www.zorba-xquery.com/modules/converters/json;; declare variable $json-value := '{html:bbold/b}'; json:serialize(json:parse($json-value)) To manage notifications about this bug go to: https://bugs.launchpad.net/zorba/+bug/920717/+subscriptions -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Bug 920717] Re: json 2.0 bug: json:serialize(json:parse(VALID_JSON))
I'm closing this bug for hopefully the last time. As we discussed, your recent bugs are UNRELATED to this bug. When you get another JSON example, open a NEW bug. Thanks. ** Changed in: zorba Status: In Progress = Fix Committed -- You received this bug notification because you are a member of Zorba Coders, which is the registrant for Zorba. https://bugs.launchpad.net/bugs/920717 Title: json 2.0 bug: json:serialize(json:parse(VALID_JSON)) Status in Zorba - The XQuery Processor: Fix Committed Bug description: Should be possible to call json:serialize(json:parse(VALID_JSON)) where VALID_JSON is any valid JSON string see added failing test test/rbkt/zorba/json/json-snelson-serialize-parse: import module namespace json=http://www.zorba-xquery.com/modules/converters/json;; declare variable $json-value := '{html:bbold/b}'; json:serialize(json:parse($json-value)) To manage notifications about this bug go to: https://bugs.launchpad.net/zorba/+bug/920717/+subscriptions -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Bug 920717] Re: json 2.0 bug: json:serialize(json:parse(VALID_JSON))
The following query: import module namespace json = http://www.zorba-xquery.com/modules/converters/json;; let $json := '{ action: GET /html/index, public: true, opt: [1, 2, {foo: bar}, null, false, true]}' let $json := json:parse($json) return json:serialize($json) Returns: JSON serialization error [zerr:ZJSE0005]: item: illegal child element of object type; must be pair ** Changed in: zorba Status: Fix Committed = In Progress -- You received this bug notification because you are a member of Zorba Coders, which is the registrant for Zorba. https://bugs.launchpad.net/bugs/920717 Title: json 2.0 bug: json:serialize(json:parse(VALID_JSON)) Status in Zorba - The XQuery Processor: In Progress Bug description: Should be possible to call json:serialize(json:parse(VALID_JSON)) where VALID_JSON is any valid JSON string see added failing test test/rbkt/zorba/json/json-snelson-serialize-parse: import module namespace json=http://www.zorba-xquery.com/modules/converters/json;; declare variable $json-value := '{html:bbold/b}'; json:serialize(json:parse($json-value)) To manage notifications about this bug go to: https://bugs.launchpad.net/zorba/+bug/920717/+subscriptions -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Bug 920717] Re: json 2.0 bug: json:serialize(json:parse(VALID_JSON))
Please don't close this bug, assign it back to me if you think that it is fixed. -- You received this bug notification because you are a member of Zorba Coders, which is the registrant for Zorba. https://bugs.launchpad.net/bugs/920717 Title: json 2.0 bug: json:serialize(json:parse(VALID_JSON)) Status in Zorba - The XQuery Processor: In Progress Bug description: Should be possible to call json:serialize(json:parse(VALID_JSON)) where VALID_JSON is any valid JSON string see added failing test test/rbkt/zorba/json/json-snelson-serialize-parse: import module namespace json=http://www.zorba-xquery.com/modules/converters/json;; declare variable $json-value := '{html:bbold/b}'; json:serialize(json:parse($json-value)) To manage notifications about this bug go to: https://bugs.launchpad.net/zorba/+bug/920717/+subscriptions -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Bug 920717] Re: json 2.0 bug: json:serialize(json:parse(VALID_JSON))
These are DIFFERENT bugs. They have NOTHING to do with serialization. When you have a query that fails, you need to try to get it to the SMALLEST possible query that fails. In this and the previous case, the call to json:serialize() is not necessary to show the bug. -- You received this bug notification because you are a member of Zorba Coders, which is the registrant for Zorba. https://bugs.launchpad.net/bugs/920717 Title: json 2.0 bug: json:serialize(json:parse(VALID_JSON)) Status in Zorba - The XQuery Processor: In Progress Bug description: Should be possible to call json:serialize(json:parse(VALID_JSON)) where VALID_JSON is any valid JSON string see added failing test test/rbkt/zorba/json/json-snelson-serialize-parse: import module namespace json=http://www.zorba-xquery.com/modules/converters/json;; declare variable $json-value := '{html:bbold/b}'; json:serialize(json:parse($json-value)) To manage notifications about this bug go to: https://bugs.launchpad.net/zorba/+bug/920717/+subscriptions -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Bug 920717] Re: json 2.0 bug: json:serialize(json:parse(VALID_JSON))
OK, I've fixed your latest bug. For the record, the smallest possible query that showed the bug was: import module namespace json = http://www.zorba- xquery.com/modules/converters/json; let $json := '{ k1 : [ { k2 : v2 }, null ] }' return json:parse( $json ) It would help if, instead of reporting bugs one-at-a-time, having me fix them, me thinking the bug is fixed, changing the status, updating the bug comment, etc, if you reported all your bugs at once. If you find any more, please open a NEW bug since the previous 2 bugs you've reported have nothing to do with this bug. ** Changed in: zorba Status: In Progress = Fix Committed ** Changed in: zorba Assignee: Paul J. Lucas (paul-lucas) = William Candillon (wcandillon) -- You received this bug notification because you are a member of Zorba Coders, which is the registrant for Zorba. https://bugs.launchpad.net/bugs/920717 Title: json 2.0 bug: json:serialize(json:parse(VALID_JSON)) Status in Zorba - The XQuery Processor: Fix Committed Bug description: Should be possible to call json:serialize(json:parse(VALID_JSON)) where VALID_JSON is any valid JSON string see added failing test test/rbkt/zorba/json/json-snelson-serialize-parse: import module namespace json=http://www.zorba-xquery.com/modules/converters/json;; declare variable $json-value := '{html:bbold/b}'; json:serialize(json:parse($json-value)) To manage notifications about this bug go to: https://bugs.launchpad.net/zorba/+bug/920717/+subscriptions -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Bug 920717] Re: json 2.0 bug: json:serialize(json:parse(VALID_JSON))
The following query: import module namespace json = http://www.zorba-xquery.com/modules/converters/json;; let $json := '{ action: GET /html/index, public: true, opt: [1, 2, {foo: bar}]}' let $json := json:parse($json) return json:serialize($json) Returns: URI_PATH/com/zorba-xquery/www/modules/converters/json.xq:196,3: JSON serialization error [zerr:ZJSE0006]: JSON type number can not have a child element node = json:serialize#1 http://www.zorba-xquery.com/modules/converters/json I think that this result is not correct. ** Changed in: zorba Status: Fix Committed = In Progress ** Changed in: zorba Assignee: Markos Zaharioudakis (markos-za) = Paul J. Lucas (paul-lucas) ** Changed in: zorba Milestone: None = 2.2 -- You received this bug notification because you are a member of Zorba Coders, which is the registrant for Zorba. https://bugs.launchpad.net/bugs/920717 Title: json 2.0 bug: json:serialize(json:parse(VALID_JSON)) Status in Zorba - The XQuery Processor: In Progress Bug description: Should be possible to call json:serialize(json:parse(VALID_JSON)) where VALID_JSON is any valid JSON string see added failing test test/rbkt/zorba/json/json-snelson-serialize-parse: import module namespace json=http://www.zorba-xquery.com/modules/converters/json;; declare variable $json-value := '{html:bbold/b}'; json:serialize(json:parse($json-value)) To manage notifications about this bug go to: https://bugs.launchpad.net/zorba/+bug/920717/+subscriptions -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Bug 920717] Re: json 2.0 bug: json:serialize(json:parse(VALID_JSON))
It was an unrelated bug. ** Changed in: zorba Status: In Progress = Fix Committed -- You received this bug notification because you are a member of Zorba Coders, which is the registrant for Zorba. https://bugs.launchpad.net/bugs/920717 Title: json 2.0 bug: json:serialize(json:parse(VALID_JSON)) Status in Zorba - The XQuery Processor: Fix Committed Bug description: Should be possible to call json:serialize(json:parse(VALID_JSON)) where VALID_JSON is any valid JSON string see added failing test test/rbkt/zorba/json/json-snelson-serialize-parse: import module namespace json=http://www.zorba-xquery.com/modules/converters/json;; declare variable $json-value := '{html:bbold/b}'; json:serialize(json:parse($json-value)) To manage notifications about this bug go to: https://bugs.launchpad.net/zorba/+bug/920717/+subscriptions -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Bug 920717] Re: json 2.0 bug: json:serialize(json:parse(VALID_JSON))
On which branch does the bug show up? I ran the query in the jsoniq branch, and I get the following result (same for all optimization levels): ?xml version=1.0 encoding=UTF-8? lt;json type=object xmlns=http://www.zorba-xquery.com/modules/converters/jsongt;lt;pair name=html type=stringgt;lt;bgt;boldlt;/bgt;lt;/pairgt;lt;/jsongt; Is this result correct? If the bug shows up in another branch, maybe that branch is not up-to- date w.r.t. the trunk? Recently, I have fixed a couple of bugs related to the no-copy rule, so if the problem is really with the no-copy rule, then the branch must be updated. -- You received this bug notification because you are a member of Zorba Coders, which is the registrant for Zorba. https://bugs.launchpad.net/bugs/920717 Title: json 2.0 bug: json:serialize(json:parse(VALID_JSON)) Status in Zorba - The XQuery Processor: New Bug description: Should be possible to call json:serialize(json:parse(VALID_JSON)) where VALID_JSON is any valid JSON string see added failing test test/rbkt/zorba/json/json-snelson-serialize-parse: import module namespace json=http://www.zorba-xquery.com/modules/converters/json;; declare variable $json-value := '{html:bbold/b}'; json:serialize(json:parse($json-value)) To manage notifications about this bug go to: https://bugs.launchpad.net/zorba/+bug/920717/+subscriptions -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Bug 920717] Re: json 2.0 bug: json:serialize(json:parse(VALID_JSON))
The bug shows up on the feature-json_parser branch. The test that fails is json-snelson-serialize-parse.xq. The test still fails even after a merge from the trunk. -- You received this bug notification because you are a member of Zorba Coders, which is the registrant for Zorba. https://bugs.launchpad.net/bugs/920717 Title: json 2.0 bug: json:serialize(json:parse(VALID_JSON)) Status in Zorba - The XQuery Processor: New Bug description: Should be possible to call json:serialize(json:parse(VALID_JSON)) where VALID_JSON is any valid JSON string see added failing test test/rbkt/zorba/json/json-snelson-serialize-parse: import module namespace json=http://www.zorba-xquery.com/modules/converters/json;; declare variable $json-value := '{html:bbold/b}'; json:serialize(json:parse($json-value)) To manage notifications about this bug go to: https://bugs.launchpad.net/zorba/+bug/920717/+subscriptions -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Bug 920717] Re: json 2.0 bug: json:serialize(json:parse(VALID_JSON))
Ok, I was able to reproduce it. But it's not due to the no-copy rule: I get the same error if I disable that rule. I will investigate further. -- You received this bug notification because you are a member of Zorba Coders, which is the registrant for Zorba. https://bugs.launchpad.net/bugs/920717 Title: json 2.0 bug: json:serialize(json:parse(VALID_JSON)) Status in Zorba - The XQuery Processor: New Bug description: Should be possible to call json:serialize(json:parse(VALID_JSON)) where VALID_JSON is any valid JSON string see added failing test test/rbkt/zorba/json/json-snelson-serialize-parse: import module namespace json=http://www.zorba-xquery.com/modules/converters/json;; declare variable $json-value := '{html:bbold/b}'; json:serialize(json:parse($json-value)) To manage notifications about this bug go to: https://bugs.launchpad.net/zorba/+bug/920717/+subscriptions -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Bug 920717] Re: json 2.0 bug: json:serialize(json:parse(VALID_JSON))
I investigated this issue a little more. The problem seems to be in the optimizer. zorba -q tmp.xq -f --optimization-level O0 returns the correct result. ?xml version=1.0 encoding=UTF-8? {html:lt;bgt;boldlt;/bgt;} whereas zorba -q tmp.xq -f --optimization-level O1 raises the error. Tracing this further, it seems as if the json:parse function returns the options element created in json:serialize (if the optimizer is used). It clearly returns the correct value if the query is used without json:serialize(...). I'm assigning this to Markos to help looking into this. If I made a guess, I would say that the problem is in the no-copy rule. ** Changed in: zorba Assignee: Paul J. Lucas (paul-lucas) = Markos Zaharioudakis (markos-za) -- You received this bug notification because you are a member of Zorba Coders, which is the registrant for Zorba. https://bugs.launchpad.net/bugs/920717 Title: json 2.0 bug: json:serialize(json:parse(VALID_JSON)) Status in Zorba - The XQuery Processor: New Bug description: Should be possible to call json:serialize(json:parse(VALID_JSON)) where VALID_JSON is any valid JSON string see added failing test test/rbkt/zorba/json/json-snelson-serialize-parse: import module namespace json=http://www.zorba-xquery.com/modules/converters/json;; declare variable $json-value := '{html:bbold/b}'; json:serialize(json:parse($json-value)) To manage notifications about this bug go to: https://bugs.launchpad.net/zorba/+bug/920717/+subscriptions -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Bug 920717] Re: json 2.0 bug: json:serialize(json:parse(VALID_JSON))
I think this is happening because of the was json:parse() is declared to return an element(*,xs:untyped)*. I need help to (1) confirm and (2) how to fix it. I don't think this bug has anything to do with my JSON parsing/serializing code per se. -- You received this bug notification because you are a member of Zorba Coders, which is the registrant for Zorba. https://bugs.launchpad.net/bugs/920717 Title: json 2.0 bug: json:serialize(json:parse(VALID_JSON)) Status in Zorba - The XQuery Processor: New Bug description: Should be possible to call json:serialize(json:parse(VALID_JSON)) where VALID_JSON is any valid JSON string see added failing test test/rbkt/zorba/json/json-snelson-serialize-parse: import module namespace json=http://www.zorba-xquery.com/modules/converters/json;; declare variable $json-value := '{html:bbold/b}'; json:serialize(json:parse($json-value)) To manage notifications about this bug go to: https://bugs.launchpad.net/zorba/+bug/920717/+subscriptions -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp