我有一个很大的json文件,我想漂亮地打印一下它的样子。 有任何实施建议吗?
我的数据包含成千上万个字典对象,例如this(这里显示2个字典):
{"target": {"tractability": {"smallmolecule": {"top_category": "Clinical_Precedence", "small_molecule_genome_member": true, "buckets": [1, 4, 5, 7, 8], "high_quality_c
ompounds": 3141, "ensemble": 0.79167199, "categories": {"clinical_precedence": 1.0, "predicted_tractable": 1.0, "discovery_precedence": 1.0}}, "antibody": {"top_catego
ry": "Predicted Tractable - Medium to low confidence", "buckets": [8], "categories": {"predicted_tractable_med_low_confidence": 0.25, "clinical_precedence": 0.0, "pred
icted_tractable_high_confidence": 0.0}}}, "gene_info": {"symbol": "PIK3CA", "name": "phosphatidylinositol-4,5-bisphosphate 3-kinase catalytic subunit alpha"}, "id": "E
NSG00000121879"}, "association_score": {"datatypes": {"literature": 0.3247602795788519, "rna_expression": 0.0, "genetic_association": 1.0, "somatic_mutation": 1.0, "kn
own_drug": 1.0, "animal_model": 0.0, "affected_pathway": 1.0}, "overall": 1.0, "datasources": {"progeny": 0.724214062011764, "sysbio": 0.0, "expression_atlas": 0.0, "e
uropepmc": 0.3247602795788519, "intogen": 0.663641617866191, "phewas_catalog": 0.0, "uniprot_literature": 1, "phenodigm": 0.0, "eva": 0.9967753031181473, "gene2phenoty
pe": 1.0, "gwas_catalog": 0.0, "slapenrich": 0.8174919500924461, "genomics_england": 1, "postgap": 0.0, "uniprot": 1, "chembl": 1, "cancer_gene_census": 0.906253232190
9299, "reactome": 1, "uniprot_somatic": 0.8682924638231565, "eva_somatic": 0.9083243889916071, "crispr": 0.983372489229025}}, "disease": {"efo_info": {"therapeutic_are
a": {"labels": ["neoplasm"], "codes": ["EFO_0000616"]}, "path": [["EFO_0000616"]], "label": "neoplasm"}, "id": "EFO_0000616"}, "is_direct": true, "evidence_count": {"d
atatypes": {"literature": 6053.0, "rna_expression": 0.0, "genetic_association": 54.0, "somatic_mutation": 999.0, "known_drug": 295.0, "animal_model": 0.0, "affected_pa
thway": 534.0}, "total": 7935.0, "datasources": {"progeny": 11.0, "sysbio": 0.0, "expression_atlas": 0.0, "europepmc": 6053.0, "intogen": 19.0, "phewas_catalog": 0.0,
"uniprot_literature": 5.0, "phenodigm": 0.0, "eva": 17.0, "gene2phenotype": 1.0, "gwas_catalog": 0.0, "slapenrich": 480.0, "genomics_england": 2.0, "postgap": 0.0, "un
iprot": 29.0, "chembl": 295.0, "cancer_gene_census": 321.0, "reactome": 36.0, "uniprot_somatic": 21.0, "eva_somatic": 638.0, "crispr": 7.0}}, "id": "ENSG00000121879-EF
O_0000616"}
{"target": {"tractability": {"smallmolecule": {"top_category": "Clinical_Precedence", "small_molecule_genome_member": true, "buckets": [1, 4, 5, 7, 8], "high_quality_c
ompounds": 453, "ensemble": 0.80422471, "categories": {"clinical_precedence": 1.0, "predicted_tractable": 1.0, "discovery_precedence": 1.0}}, "antibody": {"top_categor
y": "Predicted Tractable - High confidence", "buckets": [5, 6], "categories": {"predicted_tractable_med_low_confidence": 0.4, "clinical_precedence": 0.0, "predicted_tr
actable_high_confidence": 0.3}}}, "gene_info": {"symbol": "BRAF", "name": "B-Raf proto-oncogene, serine/threonine kinase"}, "id": "ENSG00000157764"}, "association_scor
e": {"datatypes": {"literature": 0.32548327883423844, "rna_expression": 0.0, "genetic_association": 1.0, "somatic_mutation": 1.0, "known_drug": 1.0, "animal_model": 0.
29507516111111115, "affected_pathway": 1.0}, "overall": 1.0, "datasources": {"progeny": 0.0, "sysbio": 0.0, "expression_atlas": 0.0, "europepmc": 0.32548327883423844,
"intogen": 0.5208333333333334, "phewas_catalog": 0.0, "uniprot_literature": 1.0, "phenodigm": 0.29507516111111115, "eva": 0.7947538209225032, "gene2phenotype": 1, "gwa
s_catalog": 0.0, "slapenrich": 0.7881462327789844, "genomics_england": 1, "postgap": 0.0, "uniprot": 1, "chembl": 1, "cancer_gene_census": 0.8846713673361519, "reactom
e": 1, "uniprot_somatic": 0.0, "eva_somatic": 0.9071989789312747, "crispr": 0.0}}, "disease": {"efo_info": {"therapeutic_area": {"labels": ["skin disease"], "codes": [
"EFO_0000701"]}, "path": [["EFO_0000701"]], "label": "skin disease"}, "id": "EFO_0000701"}, "is_direct": true, "evidence_count": {"datatypes": {"literature": 5518.0, "
rna_expression": 0.0, "genetic_association": 81.0, "somatic_mutation": 130.0, "known_drug": 169.0, "animal_model": 7.0, "affected_pathway": 17.0}, "total": 5922.0, "da
tasources": {"progeny": 0.0, "sysbio": 0.0, "expression_atlas": 0.0, "europepmc": 5518.0, "intogen": 2.0, "phewas_catalog": 0.0, "uniprot_literature": 1.0, "phenodigm"
: 7.0, "eva": 43.0, "gene2phenotype": 3.0, "gwas_catalog": 0.0, "slapenrich": 15.0, "genomics_england": 9.0, "postgap": 0.0, "uniprot": 25.0, "chembl": 169.0, "cancer_
gene_census": 45.0, "reactome": 2.0, "uniprot_somatic": 0.0, "eva_somatic": 83.0, "crispr": 0.0}}, "id": "ENSG00000157764-EFO_0000701"}
如何仅对前5个字典对象进行漂亮打印? 非常感谢你!