Thanks for helping!
I want to extract the names and affiliations with the format name, firstname; affiliation1 - affiliation2 - ...I wanted all the authors, not the first. The unfoldauthors code take only the first 50, but I should have removed these line. I think that my values are in the first element of the array because of the selector $.author here
my $cr = REST::Client::CrossRef->new( mailto => 'd...h', spit_raw_data => 0, add_end_flag => 1, json_path => [ ['$.title'], ['$.author'], ], json_path_callback => { '$.author' => \&unfoldauthors }, );
The unfoldauthors function is a callback pass to the $cr object. The two json_path arg are used to extract data from the whole json hashref. The data extracted with the second argument is given to the callback function.
This is the output (from the complete example) I'm having now, which is ok, but I'm asking if my callback function could have been made simpler:
***The potential of antagonistic moroccan Streptomyces isolates for the biological control of dampingÔÇÉoff disea +se of pea ( Pisum sativum L.) caused by Aphanomyces euteiches Oubaha, Brahim; Laboratory of Biology and Biotechnology of Microorgani +sms Faculty of Sciences Semlalia Cadi Ayyad University Marrakech Moro +cco - Laboratory of Interaction PlantÔÇÉMicroorganisms, Department of + Biology University of Fribourg Fribourg Switzerland Nafis, Ahmed; Laboratory of Biology and Biotechnology of Microorganism +s Faculty of Sciences Semlalia Cadi Ayyad University Marrakech Morocc +o Baz, Mohamed; Laboratory of Biology and Biotechnology of Microorganism +s Faculty of Sciences Semlalia Cadi Ayyad University Marrakech Morocc +o Mauch, Felix; Laboratory of Interaction PlantÔÇÉMicroorganisms, Depart +ment of Biology University of Fribourg Fribourg Switzerland Barakate, Mustapha; Laboratory of Biology and Biotechnology of Microor +ganisms Faculty of Sciences Semlalia Cadi Ayyad University Marrakech +Morocco - Agrobiosciences & Fertilizers Program University Mohamm +ed IV Polytechnic (UM6P) Benguerir Morocco
In reply to Re^2: JSON::Path and node iteration
by frazap
in thread JSON::Path and node iteration
by frazap
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |