Create Document Action to Download JSON File of Document

Has anyone created a document action in WebUI to download the JSON file of the document being viewed (or selected)? The Nuxeo Plugin for Chrome has a feature similar to this (it isn't downloaded, just thrown in a tab), but it would be very useful to have an action to download the JSON, or even have it be one of the options for the export action. I'm not really sure how to go about this yet, so if someone has already done it I would love to get some guidance.


0 votes

2 answers



Yes you can create an action to download anything you want really. You can see an example in nuxeo-operation-button:

When viewing a document in WebUI, you already have the document-as-JSON bound to the document property. I.e. when you define your action just make sure to bind document. So the trick is to convert that to a blob and download it. This is just a JavaScript exercise, nothing to do with Nuxeo in particular. Edit to add: if you're not happy with the contents of document (maybe it's missing a schema or some such) you can instead use the nuxeo-document element to fetch anything else you'd need:

You could also extend the export service to do a JSON export but this would require customization.

0 votes


There is no default automation operation for that but I guess the Browser Extension is simply using the document id endpoint: So idea would be to wrap the REST API call within an operation, and expose it in studio to reuse it from a button.

Have a great day

0 votes

Thanks for the response. I'll see what I can do. It does seem odd that there is an export option for XML, but not for JSON. The XML is somewhat close to what I would like, but it wraps many values in CDATA tags which is a bit cumbersome.

I would say there's no explicit "export" to JSON because this is already the native format of the REST API. You just call the REST API to get your JSON (with the bonus that you have a lot of control over the response, which schemas to fetch, which enrichers to use, etc.).