Troubleshooting JSON Validation Errors in cluster_config.json

"Not a valid JSON and cannot be parsed" Error in cluster_config.json

Issue:

One may encounter the following error while validating the cluster_config.json file:

"Not a valid JSON and cannot be parsed"

This error typically indicates an issue with the file’s formatting or structure.

Resolution:

To troubleshoot and resolve the issue, follow these steps:

1. Validate JSON Format

Run the following command to check if the JSON file is properly formatted:

cat cluster_config.json | jq .
  • If the JSON is valid, jq will format and print it correctly.

  • If there is a syntax issue, jq will report an error.

2. Ensure jq is Installed

If jq is not installed, install it using:

sudo yum install jq  #For RHEL

3. Use Online JSON Validators

Caution: Please mask all the sensitive information before using such tools. Or having a corporate online tool plan where data security is ensured is recommended.

  • Copy-paste the cluster_config.json file into online JSON validators like:

  • These tools will help identify structural issues within the JSON file.

4. Check for Hidden Characters or Incorrect Encoding

Run the following command to identify hidden characters in the file:

cat -A cluster_config.json
  • If unexpected characters are present (e.g., carriage returns ), clean them up using:

tr -d '\r' < cluster_config.json > clean_config.json
mv clean_config.json cluster_config.json

Conclusion:

By following the steps above, you should be able to validate and correct the JSON formatting in cluster_config.json. If the issue persists, ensure that no external applications or editors are introducing encoding issues or invalid modifications.

For further assistance, please reach out to UiPath Support.