EPrints Technical Mailing List Archive

Message: #08604

< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First

Re: [EP-tech] custom JSON export

Hi Phil,

So it sounds like you need to make just a small tweak to the existing JSON export plugin.  What you want to do is copy the existing JSON export plugin to your archive:

  cp EPRINTS_PATH/perl_lib/EPrints/Plugin/Export/JSON.pm EPRINTS_PATH/archives/ARCHIVE_NAME/cfg/plugins/EPrints/Plugin/Export/ReleaseToolJSON.pm

Then edit at the top of the file, replacing each occurence of Export::JSON with Export::ReleaseToolJSON and replacing Export::TextFile with Export::JSON.  When you get down to the "new" sub remove all the $self->... lines except the one for "name" and update this to "Release Tool JSON".  Then remove all the other subs (functions) except "sub _epdata_to_json".  In there you will need to make a small change, removing:

                        $subdata->{$field->get_name} = $value;

and replacing with:

                        my $field_name = $field->get_name;
                        $field_name = "id" if $field_name eq "eprintid";
                        $subdata->{$field_name} = $value;

Once you have done this.  Run "epadmin test" to check everything is OK and the reload the webserver (e.g. apachectl graceful).  If you now go to an item and look under its available export formats you should now see one labelled "Release Tool JSON".  This will be exactly the same export (as JSON) except wherever eprintid was used before id will be used instead.  However, this will mean that where documents use to reference the eprint with "eprintid" they will now use "id", which may not be what you want.  If so, you may need to amend the if statement to take the depth into account:

$field_name = "id" if $field_name eq "eprintid" && $depth == 1;


David Newman

On 11/05/2021 06:13, Phil Stacey via Eprints-tech wrote:
CAUTION: This e-mail originated outside the University of Southampton.

Good morning, working with an app to carry out reviews of automatic subject indexing created by ZBW called releasetool. https://github.com/zbw/releasetool

For this tool to connect to a catalogue requires a certain format of JSON, for example “id” instead of “eprintid”

Buildvoc is running eprints version 3.4.1, can anyone advise how to update the configuration to export as shown below. (any help would be much appreciated)


                "record": {

                                "description": [

                                                "Much of the guidance in this document is given in terms of performance classifications in relation   to British or European Standards. In such cases, it will be necessary to demonstrate that a system   or product can meet the relevant performance classification. This will be achieved if the system or   product complies with one of the following.  a. They should be in accordance with a specification or design that has been shown by a specific   test to be capable of meeting that performance classification.  b. They should have been designed by using relevant design standards in order to meet that   performance classification.  c. They should have been assessed by applying relevant test evidence, in lieu of carrying out a   specific test, as being capable of meeting that performance classification.  NOTE: Some products are subject to Classification Without Further Testing (CWFT). For the purposes   of this approved document, such products can be considered to have been shown to be  able of meeting a performance specification as per paragraph B1a."


                                "edition": [



                                "id": "884",

                                "identifier_number": [

                                                "hdl:10419/56344 [Handle]"


                                "identifier_url": [



                                "series": [

                                                "Approved Document B: Fire Safety - Volume 1: Dwellings"


                                "subject": [

                                                "Appendix B: Performance of materials, products and structures",

                                                "Building standards"


                                "title": "Para:B1 Introduction",

                                "type": "Book Section",

                                "type_genre": [

                                                "Working Paper"



                "status": 200


Best Regards,

Phil Stacey

building regulations guidance for fire safety


*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
*** Archive: http://www.eprints.org/tech.php/
*** EPrints community wiki: http://wiki.eprints.org/

Virus-free. www.avg.com