0
{
"status_code": 0,
"result_type": "DRAGON_NLU_ASR_CMD",
"NMAS_PRFX_SESSION_ID": "8c63c3ed-40da-4cdc-8ad8-1dd94ce8e466",
"NMAS_PRFX_TRANSACTION_ID": "1",
"audio_transfer_info": {
    "packages": [
        {
            "time": "20160105015723190",
            "bytes": 1668
        },
        {
            "time": "20160105015723646",
            "bytes": 7613
        }
    ],
    "nss_server": "10.56.11.186:4510",
    "end_time": "20160105015723645",
    "audio_id": 1,
    "start_time": "20160105015722835"
},
"cadence_regulatable_result": "completeRecognition",
"appserver_results": {
    "status": "success",
    "final_response": 1,
    "payload": {
        "diagnostic_info": {
            "adk_dialog_manager_status": "undefined",
            "nlu_version": "[NLU_PROJECT:NVCCP-deu-DEU];[Datapack:Version: nlps-deu-DEU-NVCCP-6.1.100.12-2-GMT20151130161021];[VL-Models:Version: vlmodels-NVCCP-deu-DEU-6.1.100.12-2-GMT20151130160231]",
            "nlps_host": "mt-dmz-nlps002.nuance.com:8636",
            "nlps_ip": "10.56.10.51",
            "application": "AUDI_2017",
            "nlu_component_flow": "[Input:VoiceJSON] [FieldID|auto_main] [NLUlib|C-eckart-r$Rev$.f20151118.1250] [build|G-r72490M.f20151130.1055] [vlmodel|Version: vlmodels-NVCCP-deu-DEU-6.1.100.12-2-GMT20151130160231] [Flow|+VlingoTokenized]",
            "third_party_delay": "0",
            "nmaid": "AUDI_SDS_2017_EXT_20151203",
            "nlps_profile": "AUDI_2017",
            "fieldId": "auto_main",
            "nlps_profile_package_version": "r159218",
            "nlu_annotator": "com.nuance.NVCCP.deu-DEU.ncs51.VlingoNLU-client-qNVCCP_NCS51",
            "ext_map_time": "3",
            "nlu_use_literal_annotator": "0",
            "int_map_time": "1",
            "nlps_nlu_type": "nlu_project",
            "nlu_language": "deu-DEU",
            "timing": {
                "finalRespSentDelay": "311",
                "intermediateRespSentDelay": "1896"
            },
            "nlps_profile_package": "AUDI_2017"
        },
        "actions": [
            {
                "Input": {
                    "Interpretations": [
                        "18 Slash 6/2015"
                    ],
                    "Type": "asr"
                },
                "Instances": [
                    {
                        "nlu_classification": {
                            "Domain": "UDE",
                            "Intention": "Unspecified"
                        },
                        "nlu_interpretation_index": 1,
                        "nlu_slot_details": {
                            "Location": {
                                "literal": "18 Slash 6/2015"
                            },
                            "Search-phrase": {
                                "literal": "18 slash 6/2015"
                            }
                        },
                        "interpretation_confidence": 3174
                    }
                ],
                "type": "nlu_results",
                "api_version": "1.0"
            }
        ],
        "nlps_version": "nlps(z):6.1.100.12.2-B359;Version: nlps-base-Zeppelin-6.1.100-B124-GMT20151130193521;"
    }
},
"final_response": 1,
"prompt": "",
"result_format": "appserver_post_results"
}

I would like to convert the above JSON to a dictionary data type in python. In the above script, I want to read this values -

{"Domain":"UDE","Intention":"Unspecified"}

I am new to json, so I am not able to understand. can someone please suggest me some ideas.

Rohit
  • 1,878
  • 19
  • 26
user2306769
  • 11
  • 2
  • 4

1 Answers1

3

Simply use json module which comes with python.

import json
json_string = '{"first_name": "Guido", "last_name":"Rossum"}'
parsed_json = json.loads(json_string)
print(parsed_json['first_name'])
"Guido"

reference : http://docs.python-guide.org/en/latest/scenarios/json/

Rohit
  • 1,878
  • 19
  • 26