Implement method to clean up json error messages

Implement testable method to clean up the weird json error messages
since they are unusable for some scopes like unmanaged-files.
Use cleanup_json_error_message for json validation error handling