Coder Social home page Coder Social logo

barely_json's People

Contributors

gvx avatar torfsen avatar tusharmakkar08 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

barely_json's Issues

Allow parsing "json" which is wrapped in "[ ]", not "{ }"

Would it be possible the library to parse json which is wrapped in [ ], not { }, like this file (from the settings file of Sublime Text, if you're interested)):

[
    {
        "caption": "Word Wrap: Toggle",
        "command": "toggle_setting",
        "args": {"setting": "word_wrap"}
    },
    {
        "caption": "Convert Case: Upper Case",
        "command": "upper_case"
    },
    { "caption": "Indexing Status", "command": "show_progress_window" },
]

AttributeError: module 'collections' has no attribute 'MutableMapping'

I'm running Python 3.10.6 on Ubuntu, and trying out barely_json for the first time. I just installed barely_json-0.1.1 with pip. Importing barely_json gives the following error:

Traceback (most recent call last):
  File "/home/velle/a/parkscraper/cmdGetJsonToQueue.py", line 1, in <module>
    import barely_json
  File "/home/jdoe/.virtualenvs/testenv/lib/python3.10/site-packages/barely_json/__init__.py", line 15, in <module>
    from pyparsing import *
  File "/home/jdoe/.virtualenvs/testenv/lib/python3.10/site-packages/pyparsing.py", line 943, in <module>
    collections.MutableMapping.register(ParseResults)
AttributeError: module 'collections' has no attribute 'MutableMapping'

JSON with no delimiter

Hey there,

It's a great library you made :-) And it is a good idea to base it on a grammar processor instead of a simple homemade state machine.

I would like to make the library work on malformed JSON with absolutely no delimiter:

badjson = '''{"ghosting_calculation": {"process_types": ["T1"  "T2"  "FLAIR"  "SWI" ]    "mask_ap": "qc_templates/maskAP.nii.gz"  "scan_type_order": ["T1"  "FLAIR"  "T2" ]    "mask_side": "qc_templates/maskSide.nii.gz"}  "segmentation": {"scan_type_order": ["T1"  "FLAIR"  "T2" ]    "brain_mask": "qc_templates/wbrainmask.nii.gz"}  "dicom2nifti": {"process_types": ["T1"  "T2"  "FLAIR"  "SWI"  "DTI"  "b0"  "rs_fMRI" ]    "deface": true  "deface_types": ["T1"  "T2"  "FLAIR"  "SWI"  "T2*" ]    "overwrite": false}  "tbi_dti_qc": {"check_gradient_table": {"process_types": ["DTI" ]  }  "dti_tensor_residual_calculation": {"process_types": ["DTI" ]  }  "temporal_snr": {"process_types": ["DTI" ]    "brain_mask": "qc_templates/wbrainmask.nii.gz"}  "percentage_signal_change": {"process_types": ["DTI" ]    "brain_mask": "qc_templates/wbrainmask.nii.gz"  "mask_threshold": 0.9}  "input_data": {"process_types": ["DTI" ]    "data_types": ["NIFTI"  "BVAL"  "BVEC" ]  }  "fa_md_feature_estimation": {"process_types": ["DTI" ]  }}  "dicom_qc": {"process_types": ["T2"  "T1"  "FLAIR"  "DTI"  "SWI"  "rs_fMRI" ]    "center": "dicom_qc"  "server_name": "neuro-imaging.center-tbi.eu"}  "smoothed_image_statistics": {"process_types": ["T1"  "T2"  "FLAIR" ]  }  "cnr_calculation": {"process_types": ["T1"  "T2"  "FLAIR"  "DTI" ]    "noise_mask": "qc_templates/maskNoise.nii.gz"  "mask_threshold": 0.9}  "scan_type_translation": {"server_name": "neuro-imaging.center-tbi.eu"}  "input_data": {"proce ss_types": ["T1"  "T2"  "FLAIR"  "SWI"  "DTI"  "b0"  "rs_fMRI" ]    "data_types": ["DICOM"  "NIFTI"  "BVAL"  "BVEC" ]  }  "tbi_report": {}  "tbi_fmri_qc": {"fmri_motion_detection": {"process_types": [  "rs_fMRI" ]    "translation_threshold": 3  "rotation_threshold": 3}  "input_data": {"process_types": ["rs_fMRI" ]    "data_types": ["NIFTI" ]  }  "percentage_signal_change": {"process_types": ["rs_fMRI" ]    "brain_mask": "qc_templates/wbrainmask.nii.gz"  "mask_threshold": 0.9}  "temporal_snr": {"process_types": ["rs_fMRI" ]    "brain_mask": "qc_templates/wbrainmask.nii.gz"}  "fmri_snr_calculation": {"process_types": ["rs_fMRI" ]  }}  "head_coverage": {"process_types": ["T1"  "T2"  "FLAIR"  "SWI"  "DTI"  "b0"  "rs_FMRI" ]    "atlas_mask": "NormalSharpAtlas/mni_icbm152_nlin_asym_09a/mni_icbm152_t1_tal_nlin_asym_09a_mask.nii.gz"}  "registration": {"process_types": ["T1"  "T2"  "FLAIR"  "SWI"  "DTI"  "b0"  "rs_fMRI" ]    "scan_type_order": ["T1"  "FLAIR"  "T2" ]  }  "gm_wm_statistics": {"process_types": ["T1"  "T2"  "FLAIR" ]  }  "snr_calculation": {"process_types": ["T1"  "T2"  "FLAIR"  "DTI" ]    "noise_mask": "qc_templates/maskNoise.nii.gz"  "mask_types": {"SWI": "CSF"  "DTI": "CSF"  "T2": "CSF"  "T1": "WM"  "B0": "CSF"  "FLAIR": "GM"}  "mask_threshold": 0.9}  "upload_results": {}  "protocol_check": {"validate_order": true  "sequence": ["T2"  "T1"  "FLAIR"  "SWI"  "DTI"  "DTI"  "rs_fMRI" ]  }}'''

This peculiar bug might happen when the host software generating this json tries to export this json data as one field of a CSV file export with the default comma delimiter, in this case, all commas will inside the JSON field will be stripped out.

Do you have any idea how to fix that?

Thanks a lot!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.