This custom actions was created that has a dependency and this argument.
In the following image you can see the code used, together with the argument and the dependency necessary to perform the download.
The dependency link is next:
Following the creation of the custom action, on the page the list of documents of said collection is called.
And finally, the button is placed in an action calling the custom action with the argument of the list of documents.
When executing and testing it, our .JSON document will be downloaded.