Hi Paul, and thanks Dirk.
One last note: If you plan to stick with JsonML, you can serialize arbitrary XML data, such as..
json:serialize( <xml>{ for $user in collection("saveresult")//user[_id="1f2cda8f-a18a-44ba-8d17-73626d472306"] return <result> <testId>{$user/test/_id}</testId> <grade>{$user/user_info/user_grade}</grade> </result> }</xml>, map { 'format': 'jsonml' } )
C.
On Fri, Jul 11, 2014 at 12:48 PM, Paul Swennenhuis paul@swennenhuis.nl wrote:
Ah, yes, that did the trick. I read about the options but had forgotten about it. Thanks. I will run some performance tests to decide for json:serialize or PHP internal conversion which might be considerably slower.
Paul
json:serialize( <json type="array" objects='_'>{ for $user in collection("saveresult")//user[_id="1f2cda8f-a18a-44ba-8d17-73626d472306"] return <_> <testId>{$user/test/_id}</testId> <grade>{$user/user_info/user_grade}</grade> </_> }</json>, map { 'format': 'jsonml' } )