Repository: aws-cloudformation/rain (go)

Issue:
"semantic difference after formatting" for FindInMap
`rain` seems to be throwing "semantic difference after formatting" error for valid YAML template.

Example template:
```
---
AWSTemplateFormatVersion: '2010-09-09'

Description: Reproduce "semantic difference after formatting" error

Parameters:
  EnvironmentParam:
    Default: dev
    Type: String
    AllowedValues:
      - dev
      - prod

Mappings:
  EnvironmentMap:
    MappedParam:
      dev: my-dev-topic
      prod: my-prod-topic

Resources:
  Topic:
    Type: AWS::SNS::Topic
    Properties: 
      TopicName: !FindInMap [ EnvironmentMap, MappedParam, !Ref EnvironmentParam ]
```

Command:
```
$ rain fmt --json example.yml
semantic difference after formatting:
(|) Resources:
(|)   Topic:
(|)     Properties:
(>)       TopicName:
(>)         - EnvironmentMap
(>)         - MappedParam
(>)         - Ref: EnvironmentParam
```

Version:
```
$ rain --version
Rain v1.3.3 linux/amd64
```

`cfn-lint` is happy with the template:
```
$ cfn-lint --info example.yml
2023-04-04 09:05:55,695 - cfnlint.runner - INFO - Run scan of template example.yml
$ cfn-lint --version
cfn-lint 0.75.1
```

Pull request:
Fix fmt error with FindInMap for JSON
Fixes #116 


Patch:
diff --git a/cft/format/json.go b/cft/format/json.go
index 75debf1b..cc5b17c9 100644
--- a/cft/format/json.go
+++ b/cft/format/json.go
@@ -5,6 +5,7 @@ import (
 	"strings"
 
 	"github.com/ake-persson/mapslice-json"
+	"github.com/aws-cloudformation/rain/cft/parse"
 	"gopkg.in/yaml.v3"
 )
 
@@ -67,11 +68,17 @@ func jsonise(node *yaml.Node) interface{} {
 
 func convertToJSON(in string) string {
 	var d yaml.Node
+
 	err := yaml.Unmarshal([]byte(in), &d)
 	if err != nil {
 		panic(err)
 	}
 
+	err = parse.TransformNode(&d)
+	if err != nil {
+		panic(err)
+	}
+
 	intermediate := jsonise(&d)
 
 	out, err := json.MarshalIndent(&intermediate, "", "    ")


Test patch:
diff --git a/cft/format/format_test.go b/cft/format/format_test.go
index be667592..0815edb9 100644
--- a/cft/format/format_test.go
+++ b/cft/format/format_test.go
@@ -157,12 +157,18 @@ const expectedJson = `{
     "Outputs": {
         "Bucket1": {
             "Value": {
-                "Fn::GetAtt": "Bucket1.Arn"
+                "Fn::GetAtt": [
+                    "Bucket1",
+                    "Arn"
+                ]
             }
         },
         "Bucket2": {
             "Value": {
-                "Fn::GetAtt": "Bucket2.Arn"
+                "Fn::GetAtt": [
+                    "Bucket2",
+                    "Arn"
+                ]
             }
         }
     }
@@ -173,12 +179,18 @@ const expectedUnsortedJson = `{
     "Outputs": {
         "Bucket1": {
             "Value": {
-                "Fn::GetAtt": "Bucket1.Arn"
+                "Fn::GetAtt": [
+                    "Bucket1",
+                    "Arn"
+                ]
             }
         },
         "Bucket2": {
             "Value": {
-                "Fn::GetAtt": "Bucket2.Arn"
+                "Fn::GetAtt": [
+                    "Bucket2",
+                    "Arn"
+                ]
             }
         }
     },