Many packages that export data from Plone have complicated dependencies, and so
only work with Plone 3.0 or higher (or not even with 3.0).
collective.jsonify‘s only dependency is simplejson. It can be installed in
any Plone version as far back as:

Plone 2.1 (or probably even Plone 2.0, but not tested)

Zope 2.6.4 (with CMF rather than Plone)

Python 2.2

The exported JSON is a collective.transmogrifier friendly format. Install
collective.jsonify on a site you want to export from, and setup an import
transmogrifier pipeline on the site you’re importing to, using the blueprints in
the collective.jsonmigrator package.

Install collective.jsonify for your Plone site, so that it is available in
your Plone site’s PYTHONPATH, including the simplejson package. The
easiest way is to use buildout, as for any other modern Plone project. Other
options include:

Play with PYTHONPATH manually.

Use easy_installcollective.jsonify or pipcollective.jsonify which
will also pull simplejson.

Note: if you are working with python 2.2, then you will need to install a `tweaked
branch of simplejson <https://github.com/simplejson/simplejson/tree/python2.2>`_.

Then run your Zope instance, go to the Zope root and create the necessary
External Methods.

It’s true that External Methods are not the nicest to work with and using them
makes the setup a little long. But the nice thing about External Methods is that
they work in Plone 1.0 as well as in Plone 4.0, so you could potentially use
collective.jsonify to migrate from very old Plone versions.

collective.jsonify is intended to be used in conjunction with
collective.jsonmigrator. There you can find an example transmogrifier
pipeline that connects to the Plone site running collective.jsonify, crawls
it, extracts the content and imports it into the target site.

To see what collective.jsonmigrator is actually seeing you can issue “json
views” on content you want to explore:

The first gets all content out of front-page; the second lists all content
contained inside this object and returns their ids.

Finally, you can use get_catalog_results to catalog query results as a list
of paths. To use it, you need to hand your query as a base64’ed Python dict
string. Here’s an example of doing this with curl:

Instead of doing on-the-fly exporting with collective.jsonmigrator, you can
also export your site’s content to json files for multiple re-use. This is done
by the export script and the external method, as described above. You can also
batch-export the contents, if you get out of memory on your exporting machine.
Here is an example on how to configure the export script for using as an
external method:

fromcollective.jsonify.exportimportexport_contentasexport_content_origdefexport_content(self):returnexport_content_orig(self,basedir='/tmp',# export directoryextra_skip_classname=['ATTopic'],batch_start=5000,batch_size=5000,batch_previous_path='/Plone/last/exported/path'# optional, but saves more memory because no item has to be jsonified before continuing...)

We try to cover the basic Plone types to export useful content out of Plone. We
cannot predict all usecases, but if you have custom requirements it’s easy to
extend functionality. You have a few options:

You can pass additional wrappers to the get_item External Method. Of course you
have to have these wrappers in your PYTHONPATH: