This adds JSON as an additional scripting documentation output format.
This can be used by external tools to examine the scripting
documentation and generate interface declarations or documentation for
any language. The existing documentation code is left largely in place.
This maintains the type information which can be used for enforce
const-correctness and also for implementing more advanced ways of
handling the type information.