In any export there is a built-in Reference Filter. The default is to “Include all selected records”. Set this filter to “Do not include records not linked to a selected person”. With this setting, only those places, sources, citations, etc that relate to the people/families of the filter will export.
As you can see, filtering results are the same in persons view and in export window but the json file contains my full db: 8546 persons as notepad++ told me when counting them:
What happens in an XML (.gramps) export? Or any of the other exports available. Import them back into Gramps to confirm the expected number of records.
Obviously the more info that can isolate where the problem resides will help those who know the code.
As a short term workaround, take the XML backup and after importing to a knew database, perform the JSON export on that complete database.
The JSON export with filter doesn’t work because the author forgot to add the lines:
if option_box:
self.option_box.parse_options()
db = option_box.get_filtered_database(db)
near the top of the exportData routine (before line 36).
You might want to tell us what you expect the JSON export to do for you; this was an experimental diagnostic plugin, which I expect few people can really use.