We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
cfn-lint throws error when !ToJsonString contains int value
### CloudFormation Lint Version

0.76.2

### What operating system are you using?

Ubuntu

### Describe the bug

Unexpected internal error during linting of rule E1031, involving `ToJsonString` of numerical value

```
2023-04-06 20:20:31,922 - cfnlint - DEBUG - Completed linting of file: templates/lambda.yml
E0002 Unknown exception while processing rule E1031: Traceback (most recent call last):
  File "/home/kftse/anaconda3/envs/aws/lib/python3.10/site-packages/cfnlint/rules/__init__.py", line 320, in run_check
    return check(*args)
  File "/home/kftse/anaconda3/envs/aws/lib/python3.10/site-packages/cfnlint/rules/__init__.py", line 44, in wrapper
    results = match_function(self, filename, cfn, *args, **kwargs)
  File "/home/kftse/anaconda3/envs/aws/lib/python3.10/site-packages/cfnlint/rules/__init__.py", line 202, in matchall
    return self.match(cfn)  # pylint: disable=E1102
  File "/home/kftse/anaconda3/envs/aws/lib/python3.10/site-packages/cfnlint/rules/functions/ToJsonString.py", line 39, in match
    LanguageExtensions.validate_pseudo_parameters(
  File "/home/kftse/anaconda3/envs/aws/lib/python3.10/site-packages/cfnlint/languageExtensions.py", line 32, in validate_pseudo_parameters
    ref_list = [val[ref] for key, val in fn_object_val.items() if ref in val]
  File "/home/kftse/anaconda3/envs/aws/lib/python3.10/site-packages/cfnlint/languageExtensions.py", line 32, in <listcomp>
    ref_list = [val[ref] for key, val in fn_object_val.items() if ref in val]
TypeError: argument of type 'int' is not iterable

cfn-secrets-stack.yml:1:1

E0002 Unknown exception while processing rule E1031: Traceback (most recent call last):
  File "/home/kftse/anaconda3/envs/aws/lib/python3.10/site-packages/cfnlint/rules/__init__.py", line 320, in run_check
    return check(*args)
  File "/home/kftse/anaconda3/envs/aws/lib/python3.10/site-packages/cfnlint/rules/__init__.py", line 44, in wrapper
    results = match_function(self, filename, cfn, *args, **kwargs)
  File "/home/kftse/anaconda3/envs/aws/lib/python3.10/site-packages/cfnlint/rules/__init__.py", line 202, in matchall
    return self.match(cfn)  # pylint: disable=E1102
  File "/home/kftse/anaconda3/envs/aws/lib/python3.10/site-packages/cfnlint/rules/functions/ToJsonString.py", line 39, in match
    LanguageExtensions.validate_pseudo_parameters(
  File "/home/kftse/anaconda3/envs/aws/lib/python3.10/site-packages/cfnlint/languageExtensions.py", line 32, in validate_pseudo_parameters
    ref_list = [val[ref] for key, val in fn_object_val.items() if ref in val]
  File "/home/kftse/anaconda3/envs/aws/lib/python3.10/site-packages/cfnlint/languageExtensions.py", line 32, in <listcomp>
    ref_list = [val[ref] for key, val in fn_object_val.items() if ref in val]
TypeError: argument of type 'int' is not iterable

cfn-secrets-stack.yml:1:1
```

### Expected behavior

String quoted int should work as well as int, both are valid json

### Reproduction template

This works
```yaml
Resources:
  DeploymentProperties:
    Properties:
      Description: "testing"
      Name: 'Test'
      SecretString: !ToJsonString
        SomeNumber: '3'
    Type: AWS::SecretsManager::Secret
Transform: AWS::LanguageExtensions
```

This does not, with the above error
```yaml
Resources:
  DeploymentProperties:
    Properties:
      Description: "testing"
      Name: 'Test'
      SecretString: !ToJsonString
        SomeNumber: 3
    Type: AWS::SecretsManager::Secret
Transform: AWS::LanguageExtensions
```


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `src/cfnlint/languageExtensions.py`
Content:
```
1 from cfnlint.rules import RuleMatch
2 
3 
4 class LanguageExtensions:
5     """Class for a CloudFormation languageExtensions"""
6 
7     def validate_transform_is_declared(
8         self, has_language_extensions_transform, matches, tree, intrinsic_function
9     ):
10         if not has_language_extensions_transform:
11             message = (
12                 "Missing Transform: Declare the AWS::LanguageExtensions Transform globally to enable use"
13                 " of the intrinsic function " + intrinsic_function + " at {0}"
14             )
15             matches.append(RuleMatch(tree[:], message.format("/".join(map(str, tree)))))
16         return matches
17 
18     def validate_type(self, fn_object_val, matches, tree, intrinsic_function):
19         if not isinstance(fn_object_val, dict) and not isinstance(fn_object_val, list):
20             message = intrinsic_function + " needs a map or a list at {0}"
21             matches.append(RuleMatch(tree[:], message.format("/".join(map(str, tree)))))
22         elif len(fn_object_val) == 0:
23             message = "Invalid value for " + intrinsic_function + " for {0}"
24             matches.append(RuleMatch(tree[:], message.format("/".join(map(str, tree)))))
25         return matches
26 
27     def validate_pseudo_parameters(
28         self, fn_object_val, matches, tree, pseudo_params, intrinsic_function
29     ):
30         if isinstance(fn_object_val, dict):
31             ref = "Ref"
32             ref_list = [val[ref] for key, val in fn_object_val.items() if ref in val]
33             for ref in ref_list:
34                 if ref in pseudo_params:
35                     message = (
36                         intrinsic_function
37                         + " does not support the pseudo parameter "
38                         + ref
39                         + " for {0}"
40                     )
41                     matches.append(
42                         RuleMatch(tree[:], message.format("/".join(map(str, tree))))
43                     )
44         return matches
45
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/src/cfnlint/languageExtensions.py b/src/cfnlint/languageExtensions.py
--- a/src/cfnlint/languageExtensions.py
+++ b/src/cfnlint/languageExtensions.py
@@ -29,7 +29,11 @@
     ):
         if isinstance(fn_object_val, dict):
             ref = "Ref"
-            ref_list = [val[ref] for key, val in fn_object_val.items() if ref in val]
+            ref_list = [
+                val[ref]
+                for _, val in fn_object_val.items()
+                if hasattr(val, "__iter__") and ref in val
+            ]
             for ref in ref_list:
                 if ref in pseudo_params:
                     message = (

{"golden_diff": "diff --git a/src/cfnlint/languageExtensions.py b/src/cfnlint/languageExtensions.py\n--- a/src/cfnlint/languageExtensions.py\n+++ b/src/cfnlint/languageExtensions.py\n@@ -29,7 +29,11 @@\n     ):\n         if isinstance(fn_object_val, dict):\n             ref = \"Ref\"\n-            ref_list = [val[ref] for key, val in fn_object_val.items() if ref in val]\n+            ref_list = [\n+                val[ref]\n+                for _, val in fn_object_val.items()\n+                if hasattr(val, \"__iter__\") and ref in val\n+            ]\n             for ref in ref_list:\n                 if ref in pseudo_params:\n                     message = (\n", "issue": "cfn-lint throws error when !ToJsonString contains int value\n### CloudFormation Lint Version\n\n0.76.2\n\n### What operating system are you using?\n\nUbuntu\n\n### Describe the bug\n\nUnexpected internal error during linting of rule E1031, involving `ToJsonString` of numerical value\r\n\r\n```\r\n2023-04-06 20:20:31,922 - cfnlint - DEBUG - Completed linting of file: templates/lambda.yml\r\nE0002 Unknown exception while processing rule E1031: Traceback (most recent call last):\r\n  File \"/home/kftse/anaconda3/envs/aws/lib/python3.10/site-packages/cfnlint/rules/__init__.py\", line 320, in run_check\r\n    return check(*args)\r\n  File \"/home/kftse/anaconda3/envs/aws/lib/python3.10/site-packages/cfnlint/rules/__init__.py\", line 44, in wrapper\r\n    results = match_function(self, filename, cfn, *args, **kwargs)\r\n  File \"/home/kftse/anaconda3/envs/aws/lib/python3.10/site-packages/cfnlint/rules/__init__.py\", line 202, in matchall\r\n    return self.match(cfn)  # pylint: disable=E1102\r\n  File \"/home/kftse/anaconda3/envs/aws/lib/python3.10/site-packages/cfnlint/rules/functions/ToJsonString.py\", line 39, in match\r\n    LanguageExtensions.validate_pseudo_parameters(\r\n  File \"/home/kftse/anaconda3/envs/aws/lib/python3.10/site-packages/cfnlint/languageExtensions.py\", line 32, in validate_pseudo_parameters\r\n    ref_list = [val[ref] for key, val in fn_object_val.items() if ref in val]\r\n  File \"/home/kftse/anaconda3/envs/aws/lib/python3.10/site-packages/cfnlint/languageExtensions.py\", line 32, in <listcomp>\r\n    ref_list = [val[ref] for key, val in fn_object_val.items() if ref in val]\r\nTypeError: argument of type 'int' is not iterable\r\n\r\ncfn-secrets-stack.yml:1:1\r\n\r\nE0002 Unknown exception while processing rule E1031: Traceback (most recent call last):\r\n  File \"/home/kftse/anaconda3/envs/aws/lib/python3.10/site-packages/cfnlint/rules/__init__.py\", line 320, in run_check\r\n    return check(*args)\r\n  File \"/home/kftse/anaconda3/envs/aws/lib/python3.10/site-packages/cfnlint/rules/__init__.py\", line 44, in wrapper\r\n    results = match_function(self, filename, cfn, *args, **kwargs)\r\n  File \"/home/kftse/anaconda3/envs/aws/lib/python3.10/site-packages/cfnlint/rules/__init__.py\", line 202, in matchall\r\n    return self.match(cfn)  # pylint: disable=E1102\r\n  File \"/home/kftse/anaconda3/envs/aws/lib/python3.10/site-packages/cfnlint/rules/functions/ToJsonString.py\", line 39, in match\r\n    LanguageExtensions.validate_pseudo_parameters(\r\n  File \"/home/kftse/anaconda3/envs/aws/lib/python3.10/site-packages/cfnlint/languageExtensions.py\", line 32, in validate_pseudo_parameters\r\n    ref_list = [val[ref] for key, val in fn_object_val.items() if ref in val]\r\n  File \"/home/kftse/anaconda3/envs/aws/lib/python3.10/site-packages/cfnlint/languageExtensions.py\", line 32, in <listcomp>\r\n    ref_list = [val[ref] for key, val in fn_object_val.items() if ref in val]\r\nTypeError: argument of type 'int' is not iterable\r\n\r\ncfn-secrets-stack.yml:1:1\r\n```\n\n### Expected behavior\n\nString quoted int should work as well as int, both are valid json\n\n### Reproduction template\n\nThis works\r\n```yaml\r\nResources:\r\n  DeploymentProperties:\r\n    Properties:\r\n      Description: \"testing\"\r\n      Name: 'Test'\r\n      SecretString: !ToJsonString\r\n        SomeNumber: '3'\r\n    Type: AWS::SecretsManager::Secret\r\nTransform: AWS::LanguageExtensions\r\n```\r\n\r\nThis does not, with the above error\r\n```yaml\r\nResources:\r\n  DeploymentProperties:\r\n    Properties:\r\n      Description: \"testing\"\r\n      Name: 'Test'\r\n      SecretString: !ToJsonString\r\n        SomeNumber: 3\r\n    Type: AWS::SecretsManager::Secret\r\nTransform: AWS::LanguageExtensions\r\n```\r\n\n", "before_files": [{"content": "from cfnlint.rules import RuleMatch\n\n\nclass LanguageExtensions:\n    \"\"\"Class for a CloudFormation languageExtensions\"\"\"\n\n    def validate_transform_is_declared(\n        self, has_language_extensions_transform, matches, tree, intrinsic_function\n    ):\n        if not has_language_extensions_transform:\n            message = (\n                \"Missing Transform: Declare the AWS::LanguageExtensions Transform globally to enable use\"\n                \" of the intrinsic function \" + intrinsic_function + \" at {0}\"\n            )\n            matches.append(RuleMatch(tree[:], message.format(\"/\".join(map(str, tree)))))\n        return matches\n\n    def validate_type(self, fn_object_val, matches, tree, intrinsic_function):\n        if not isinstance(fn_object_val, dict) and not isinstance(fn_object_val, list):\n            message = intrinsic_function + \" needs a map or a list at {0}\"\n            matches.append(RuleMatch(tree[:], message.format(\"/\".join(map(str, tree)))))\n        elif len(fn_object_val) == 0:\n            message = \"Invalid value for \" + intrinsic_function + \" for {0}\"\n            matches.append(RuleMatch(tree[:], message.format(\"/\".join(map(str, tree)))))\n        return matches\n\n    def validate_pseudo_parameters(\n        self, fn_object_val, matches, tree, pseudo_params, intrinsic_function\n    ):\n        if isinstance(fn_object_val, dict):\n            ref = \"Ref\"\n            ref_list = [val[ref] for key, val in fn_object_val.items() if ref in val]\n            for ref in ref_list:\n                if ref in pseudo_params:\n                    message = (\n                        intrinsic_function\n                        + \" does not support the pseudo parameter \"\n                        + ref\n                        + \" for {0}\"\n                    )\n                    matches.append(\n                        RuleMatch(tree[:], message.format(\"/\".join(map(str, tree))))\n                    )\n        return matches\n", "path": "src/cfnlint/languageExtensions.py"}], "after_files": [{"content": "from cfnlint.rules import RuleMatch\n\n\nclass LanguageExtensions:\n    \"\"\"Class for a CloudFormation languageExtensions\"\"\"\n\n    def validate_transform_is_declared(\n        self, has_language_extensions_transform, matches, tree, intrinsic_function\n    ):\n        if not has_language_extensions_transform:\n            message = (\n                \"Missing Transform: Declare the AWS::LanguageExtensions Transform globally to enable use\"\n                \" of the intrinsic function \" + intrinsic_function + \" at {0}\"\n            )\n            matches.append(RuleMatch(tree[:], message.format(\"/\".join(map(str, tree)))))\n        return matches\n\n    def validate_type(self, fn_object_val, matches, tree, intrinsic_function):\n        if not isinstance(fn_object_val, dict) and not isinstance(fn_object_val, list):\n            message = intrinsic_function + \" needs a map or a list at {0}\"\n            matches.append(RuleMatch(tree[:], message.format(\"/\".join(map(str, tree)))))\n        elif len(fn_object_val) == 0:\n            message = \"Invalid value for \" + intrinsic_function + \" for {0}\"\n            matches.append(RuleMatch(tree[:], message.format(\"/\".join(map(str, tree)))))\n        return matches\n\n    def validate_pseudo_parameters(\n        self, fn_object_val, matches, tree, pseudo_params, intrinsic_function\n    ):\n        if isinstance(fn_object_val, dict):\n            ref = \"Ref\"\n            ref_list = [\n                val[ref]\n                for _, val in fn_object_val.items()\n                if hasattr(val, \"__iter__\") and ref in val\n            ]\n            for ref in ref_list:\n                if ref in pseudo_params:\n                    message = (\n                        intrinsic_function\n                        + \" does not support the pseudo parameter \"\n                        + ref\n                        + \" for {0}\"\n                    )\n                    matches.append(\n                        RuleMatch(tree[:], message.format(\"/\".join(map(str, tree))))\n                    )\n        return matches\n", "path": "src/cfnlint/languageExtensions.py"}]}