Groovy web console

subscribe to the feed Subscribe
to this
site

Convert LinkedHashMap to List for push

Published 2 months ago by Rutger de Vries with tags push linkedhashmap
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
import groovy.json.JsonSlurper
string = '''{
    "SVDF": "string",
    "code": "string",
    "gender": "F",
    "consumeAuthorization": true,
    "locationTypeUsage": "I",
    "procedureConditionUsage": "I",
    "type": "A",
    "procedureGroup3Usage": "I",
    "defaultServiceDefinition": true,
    "ageTo": 0,
    "shortCode": "string",
    "active": true,
    "modifierUsage": "I",
    "procedureGroup2Usage": "I",
    "SVDATE": "2015-07-20",
    "descr": "string",
    "ageFrom": 0,
    "specialtyUsage": "I",
    "procedureGroup1Usage": "I",
    "diagnosisGroupUsage": "I",
    "SVFC": {
        "flexCodeDefinitionCode": "string",
        "value": "string"
    },
    "diagnosisGroup": {
        "id": 0
    },
    "diagnosisType": {
        "id": 0
    },
    "procedureGroup": {
        "id": 0
    },
    "serviceDefinitionPriority": {
        "id": 0
    },
    "conditionDynamicLogicProcedureGroup": {
        "id": 0
    },
    "claimFormType": {
        "id": 0
    },
    "conditionDynamicLogicDiagnosisGroup": {
        "id": 0
    },
    "caseDefinition": {
        "id": 0
    },
    "procedureGroup2": {
        "id": 0
    },
    "procedureGroup3": {
        "id": 0
    },
    "service": {
        "id": 0
    },
    "MVFC": [
        {
            "flexCodeDefinitionCode": "string",
            "value": "string"
        }
    ],
    "serviceDefinitionLocationTypeList": [
        {
            "locationType": {
                "id": 0
            }
        }
    ],
    "MVDF": [
        {
            "value": "string"
        }
    ],
    "serviceDefinitionModifierList": [
        {
            "modifier": {
                "id": 0
            }
        }
    ],
    "serviceDefinitionSpecialtyList": [
        {
            "specialty": {
                "id": 0
            }
        }
    ],
    "serviceDefinitionConditionList": [
        {
            "dynamicLogic": {
                "id": 0
            }
        }
    ]
}'''
json = new JsonSlurper().parseText(string)
headerList = json.keySet() as List
headerList.remove('code')
headerList.push('code')
headerList