So my concept (which nobody else is interested in, so thanks) was not to
provide "full" XMPP support exposed to every web page - I think that'd be a
disaster, and isn't actually needed anyway.
Instead I was after a way to get at the pubsub service and other
fundamental constructs and expose those; so you wouldn't be able to write a
MUC client in Javascript, but you could do PubSub - albeit without having
to read XEP-0060 at all. I didn't think that even IM was interesting
enough, but I could be persuaded otherwise.
So far, this aligns well with what you're saying - you wouldn't be using
your REST API to send raw stanza data, but to provide a gatewayed mechanism
into XMPP protocol constructs.
However, I don't think that JSON is particularly interesting as a format
for XMPP transport. I'm not violently against JSON or anything, but I'd
rather keep XMPP as an XML routing protocol - it's done well in that space,
and a large number of tools exist which assume that it's XML going on the
wire. The thing that *is* really good about JSON is that it's simple to
translate 1:1 between a variable value and a wire format - data, not
objects.
So a mapping that goes from JSON -> XML -> JSON isn't quite what I'm
thinking; I'm thinking about an XML schema(ish) that sits in the same space
as JSON. Let's call it MLD - for Markup Language Data - we need to drop the
'X' because it isn't, and it also lets us call it "Meld", which amuses me.
In terms of properties, it's exactly the same as JSON - the only thing it
misses out is the eval-based parsing that JSON has.
This has some nice properties - it's entirely schemaless, but to us, it's
just another XML dialect we can use for payloads. To a browser, though,
it's allowing them to deal with the protocol *without* having to mangle
data for transmission - and I think that's the key feature of JSON people
actually want.
So this gives you something like:
<object xmlns='urn:xmpp:mld'>
<array name='foo'>
<string>First string in array foo</string>
</array>
<boolean name='done'>true</boolean>
</object>
Which corresponds precisely to:
{"foo":["First string in array foo"],"done":True}
Dave.