commons icon indicating copy to clipboard operation
commons copied to clipboard

JSON serialization of sequences of elements

Open jmakeig opened this issue 14 years ago • 3 comments

The existing json:serialize function only allows passing in a single element(). It would be convenient to also pass in a sequence of elements and have them serialized as an Array.

jmakeig avatar Oct 08 '11 07:10 jmakeig

Yea, this library was never intended to return an array but could easily be modified to do so, as suggested.

That said, the json.xqy library in commons is quickly being replaced by the MLJSON project (https://github.com/marklogic/mljson). MLJSON is much more flexible in it's ability to construct JSON strings by including support for creating arrays, objects, a javascript NULL, etc. So I'm much more tempted to add this functionality into that library to encourage folks to switch. Thoughts?

ryangrimm avatar Oct 08 '11 12:10 ryangrimm

I couldn’t get MLJSON to work, but I didn’t debug very thoroughly. I’ll try again and let you know.

jmakeig avatar Oct 09 '11 09:10 jmakeig

Were you trying to use MLJSON to transform arbitrary XML into JSON? If so, it doesn't do that :).

ryangrimm avatar Oct 09 '11 14:10 ryangrimm