Home > Blockchain >  Invalid string: control characters in github action - jq
Invalid string: control characters in github action - jq

Time:07-29

Good Afternoon all,

I am presenting the following problem.

new_ecdsa_config.json looks something like:

{
  "certificate": "value long string
                          multine"
}

When I run the github action for reading the value

  - name: Add new ECDSA to Organization
    run: |
      cat new_ecdsa_config.json | jq '.'

I get the following error:

parse error: Invalid string: control characters from U 0000 through U 001F must be escaped at line 26, column 53
Error: Process completed with exit code 4.

Any ideas??

CodePudding user response:

When you described the problem on github, you gave this as the example:

{
  "certificate": "value long string
                          multine"
}

As the error message says, that is not valid JSON. (You can double-check this at jsonlint.com if you like.)

If you want the JSON representation of a multiline string, you'd have to escape the newline, e.g. along the lines of:

{
  "certificate": "value long string\nmultiline"
}
  • Related