Andy, 1. I am pelase that JSON result objects are mapped to JavaScript objects. Are undefined values handled (e.g. XQuery () vs JavaScript undefined)? 2. I am using basex-node and having trouble binding objects in a query. I would like to have the object result in an XQUERY map. It would be nice if undefined values as defined above are handled as well. For now I have to do something like this'$x := map ' +JSON.stringify(obj).replace('undefined', '()'). I hope this make sense.
Hi E. Wray, 1. basex-node results are always strings but you can use JSON.parse on that string, if that is appropriate because for example of the serialization used. See [1],[2] for examples 2. Do you mean you would like query.bind [3] to automatically convert "undefined" to ()? If so, or indeed if you mean something different, best to create an issue in the basex-node project on github. Regards /Andy [0] https://github.com/apb2006/basex-node [1] https://github.com/apb2006/basex-node/blob/master/examples/json.js [2] https://github.com/apb2006/basex-node/blob/master/examples/json2.js [3] https://github.com/apb2006/basex-node/blob/master/docs/commands.md#the-query... On 15 November 2017 at 16:17, E. Wray Johnson <wray.johnson@gmail.com> wrote:
Andy,
1. I am pelase that JSON result objects are mapped to JavaScript objects. Are undefined values handled (e.g. XQuery () vs JavaScript undefined)? 2. I am using basex-node and having trouble binding objects in a query. I would like to have the object result in an XQUERY map. It would be nice if undefined values as defined above are handled as well. For now I have to do something like this'$x := map ' +JSON.stringify(obj).replace('undefined', '()').
I hope this make sense.
participants (2)
-
Andy Bunce -
E. Wray Johnson