Notice: The 3DNA Forum is now a read-only archive. See the announcement.
All active support and discussions have moved to GitHub Discussions!

Author Topic: JSON output should escape backslashes  (Read 239794 times)

Offline Bernhard10

  • non-commercial
  • with-posts
  • *
  • Posts: 4
    • View Profile
JSON output should escape backslashes
« on: November 29, 2018, 04:39:59 am »
When I give DSSR a filename which contains a backslash (e.g. as a path seperator on Windows), this backslash gets included in the created JSON in the fields "command", "input_file" and possibly "str_id".
This makes the JSON invalid and impossible to parse, because backslashes are escape characters in JSON and have to be escaped as "\\" to produce valid JSON.

Example:
rename 1rnk.pdb into '1rnk\something.pdb'
./x3dna-dssr -i='1rnk\something.pdb' --json

Gives a JSON including
{"command":"x3dna-dssr -i=1rnk\something.pdb --json","input_file":"1rnk\something.pdb","str_id":"1rnk\something"

instead of
{"command":"x3dna-dssr -i=1rnk\\something.pdb --json","input_file":"1rnk\\something.pdb","str_id":"1rnk\\something"

Offline xiangjun

  • Administrator
  • with-posts
  • *****
  • Posts: 1746
    • View Profile
    • 3DNA homepage
Re: JSON output should escape backslashes
« Reply #1 on: November 29, 2018, 10:24:14 am »
Thanks for reporting the JSON string escape bug in DSSR. Your bug report is exemplary in its clarity. I'll fix this bug and release an updated DSSR version, hopefully shortly.

Best regards,

Xiang-Jun
Dr. Xiang-Jun Lu[律祥俊]
Email: xiangjun@x3dna.org
Homepage: https://x3dna.org
wDSSR: https://web.x3dna-dssr.org
GitHub: https://github.com/x3dna-dssr

Offline xiangjun

  • Administrator
  • with-posts
  • *****
  • Posts: 1746
    • View Profile
    • 3DNA homepage
Re: JSON output should escape backslashes
« Reply #2 on: November 29, 2018, 11:14:45 am »
I've updated DSSR to v1.8.5-2018nov29. The bug of not escaping backslash (or double quote) in DSSR JSON output has been fixed.

Please have a try and report back how it goes.

Best regards,

Xiang-Jun
Dr. Xiang-Jun Lu[律祥俊]
Email: xiangjun@x3dna.org
Homepage: https://x3dna.org
wDSSR: https://web.x3dna-dssr.org
GitHub: https://github.com/x3dna-dssr

 

This forum is archived. Please post new questions on GitHub Discussions!