bazaarvoice / jolt

JSON to JSON transformation library written in Java.
Apache License 2.0
1.54k stars 328 forks source link

Jolt spec for transforming input spec in to output spec for nested elements #1156

Open bhushanibm opened 2 years ago

bhushanibm commented 2 years ago

Input spec is given below

{
  "uid": "78fb88d3-06ba-4150-b700-1153aabb0ad2",
  "Name": "catalif",
  "Class": {
    "ID": 8,
    "Value": "TA",
    "Name": "TA",
    "Description": "TA that represent items like database columns, schemas, XML attributes, etc.",
    "AllowCommentsOnAsset": true
  },
  "Description": "Connect asset type that is used to discover the connect assets",
  "AutoDisplayDescription": true,
  "Hierarchical": false,
  "HierarchyMaximumDepth": 0,
  "DisplayFormat": "{Name}",
  "CanEditParent": true,
  "metamodel_asset_fields": [
    {
      "Name": "Name",
      "FriendlyName": "Name",
      "AssetTypeUid": "1111",
      "Type": {
        "Text": {
          "Validation": {
            "MinimumLength": 1,
            "MaximumLength": 500,
            "IsRequired": true
          },
          "Search": {
            "AddToResult": false
          },
          "ColumnOrder": 0,
          "SortOrder": 1,
          "ShowIfEmpty": false
        }
      }
    },
    {
      "Name": "Ctype",
      "FriendlyName": "Ctype",
      "AssetTypeUid": "78fb88d3-06ba-4150-b700-1153aabb0ad2",
      "Type": {
        "Text": {
          "Validation": {
            "MinimumLength": 0,
            "IsRequired": false
          },
          "Search": {
            "AddToResult": false
          },
          "DisplayInColumn": false,
          "ColumnOrder": 1,
          "SortOrder": 0,
          "SortByAscending": true,
          "IsDisplayable": true,
          "ShowIfEmpty": false
        }
      }
    },
    {
      "Name": "Description",
      "FriendlyName": "Description",
      "AssetTypeUid": "78fb88d3-06ba-4150-b700-1153aabb0ad2",
      "Type": {
        "Text": {
          "Validation": {
            "MinimumLength": 0,
            "IsRequired": false
          },
          "Search": {
            "AddToResult": false
          },
          "DisplayInColumn": false,
          "ColumnOrder": 2,
          "SortOrder": 0,
          "SortByAscending": true,
          "IsDisplayable": true,
          "ShowIfEmpty": false
        }
      }
    }
  ]
}

output spec should be

"name": "catalif",
            "properties": [
                {
                    "name": "uid",
                    "value": "78fb88d3-06ba-4150-b700-1153aabb0ad2"
                },
{
                    "name": "AutoDisplayDescription",
                    "value": true
                },
            ],

            "fields": [
                {
                    "name": "Description",
                    "value": {
                        "properties": [
                            {
                        "name": "DisplayInColumn",
                    "value": false
                            }
                        ]
                    }
                }
            ],