Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return clean JSON result #118

Open
NVBPF opened this issue Jan 15, 2025 · 0 comments
Open

Return clean JSON result #118

NVBPF opened this issue Jan 15, 2025 · 0 comments
Labels
feature request New feature or request

Comments

@NVBPF
Copy link

NVBPF commented Jan 15, 2025

Is your feature request related to a problem? Please describe.

When getting the output of a command via the feature introduced in #113, the full output of the command is returned, even if called with --format json or --format simple-json, making the result not parseable as JSON due to several lines of informational output before the JSON-formatted output is returned.

Describe the solution you'd like to see

If --format json or --format simple-json are set, only return the JSON output if returned in a script.

script {
    String result = jf 'audit --format json'
    def json = new JsonSlurper().parseText(result)
}

Describe alternatives you've considered

No response

Additional context

Current result of trying to parse result as JSON:

09:31:48 [Info] Performing scans on 1 targets:
[
  {
    "target": "/var/jenkins/workspace/something",
    "technology": "maven"
  }
]
09:31:48 [Info] Not entitled for JAS, skipping advance security scans...
09:31:48 [Info] Calculating Maven dependencies...
...........
A JSON payload should start with an openning curly brace '{' or an openning square bracket '['.
Instead, '09' was found on line: 1, column: 1
@NVBPF NVBPF added the feature request New feature or request label Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant