Cannot Parse json output: jq: parse error: Invalid numeric literal #827
Labels
No Label
bug
data loss
design finalized
good first issue
new feature area
question / support
security
waiting for response
No Milestone
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: borgmatic-collective/borgmatic#827
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What I'm trying to do and why
Hi, i am trying to write a Python Script to export Data about my Borg Repositories.
But i am having Problems parsing the output.
I tried following:
but i get following error:
jq: parse error: Invalid numeric literal at line 1, column 649
i also tried with subprocess and json.dumps but i get a simmilar error.
is there something wrong on my site?
i got a
[ESC]
,%
and some other weird things at the end of my json output string.Steps to reproduce
No response
Actual behavior
No response
Expected behavior
No response
Other notes / implementation ideas
No response
borgmatic version
1.8.8
borgmatic installation method
AUR
Borg version
borg 1.2.7
Python version
3.11.7
Database version (if applicable)
No response
Operating system and version
No response
Thanks for filing this, but so far I'm not able to reproduce it. Can I get a look at your borgmatic JSON output including the weird characters? If they're not showing up with copy and paste, feel free to redirect to a file and then attach the file here. And you can redact anything sensitive, of course. Thank you!
is what i get from following for example:
it kinda works with jq but there is still an Error:
cmdline:
Got it woking by removing the ANSI from the String with a regex.
Maybe this is because of the Colored output?
Thanks for the additional details. I don't have a local repro still, but I think I know what might be going on. That code you're getting is a "styling reset" escape code, so even though colors are disabled automatically when
--json
is given, that reset code is still coming through for some reason. I'll mark this as a bug and look into suppressing the code.Okay, this should hopefully be fixed in main and will be part of the next release!
Released in borgmatic 1.8.9!