shenwei356 / taxonkit

A Practical and Efficient NCBI Taxonomy Toolkit, also supports creating NCBI-style taxdump files for custom taxonomies like GTDB/ICTV
https://bioinf.shenwei.me/taxonkit
MIT License
369 stars 29 forks source link

JSON output is malformed when running `taxonkit list` #30

Closed standage closed 4 years ago

standage commented 4 years ago

Adding the --json flag to the example included in the documentation for taxonkit list produces output that is not well-formed JSON.

$ taxonkit list --json --ids 9605,239934 > result.json

This can be confirmed with a JSON linter like https://jsonlint.com/ or, as I discovered it, with Python's JSON parser.

>>> import json
>>> with open('result.json') as fh:
...   result = json.load(fh)
Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
  File "/home/standage/anaconda3/envs/taxonkit/lib/python3.7/json/__init__.py", line 296, in load
    parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
  File "/home/standage/anaconda3/envs/taxonkit/lib/python3.7/json/__init__.py", line 348, in loads
    return _default_decoder.decode(s)
  File "/home/standage/anaconda3/envs/taxonkit/lib/python3.7/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/home/standage/anaconda3/envs/taxonkit/lib/python3.7/json/decoder.py", line 353, in raw_decode
    obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting ',' delimiter: line 13 column 5 (char 149)
>>>

Prerequisites

Describe your issue

shenwei356 commented 4 years ago

fixed:

standage commented 4 years ago

Looks great—I confirmed it's working on my end. Thanks for the prompt response!

standage commented 4 years ago

I'm working on Python bindings for TaxonKit. Please let me know when a bugfix release is available from bioconda.

shenwei356 commented 4 years ago

In 1-2 day.