Repository: aws-cloudformation/cfn-lint

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
```



Discussion:

Resolving patch:
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 @@ def validate_pseudo_parameters(
     ):
         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 = (


Test patch:
diff --git a/test/fixtures/templates/good/functions_findinmap_default_value.yaml b/test/fixtures/templates/good/functions_findinmap_default_value.yaml
--- a/test/fixtures/templates/good/functions_findinmap_default_value.yaml
+++ b/test/fixtures/templates/good/functions_findinmap_default_value.yaml
@@ -75,6 +75,7 @@ Resources:
         - 'Fn::ToJsonString':
             To: Json
             String: Function
+            Value: 1
         - SecondKey1
         - DefaultValue: Mesh2
   Mesh3: