I do like that MarkLogic has a to-json function and that I don't need to download third-party code to make something like JSON work, especially in 2010, years after JSON has become a fairly well known standard.
One problem I ran into was that when a sequence is converted to JSON, a JSON array is returned.
('a', 'b', 'c', 'd')
['a', 'b', 'c', 'd']
The problem comes when only one value is returned in a sequence, such as
('a'). This now becomes the string
'[' to the beginning and
']' to the end to give me a valid JSON array.
If I could have, I would have changed the autocomplete plugin to accept a string JSON parameter as well and then the MarkLogic code would have worked fine.