Link to home
Start Free TrialLog in
Avatar of Rohit Bajaj
Rohit BajajFlag for India

asked on

Fetching values from JSON into java variables

HI,
I have the following Json in a String Object in java:
{
    "resCode": 200,
    "resMessage": "Success",
    "interactionId": "65aaeec4-5f3a-45c8-b842-cd27177402b3",
    "interationType": "FlightSearch",
    "sessionId": "83c172f7-a379-4737-926d-0f016be4c59c",
    "response": {
        "request": {
            "tripType": "ONEWAY",
            "tripList": [
                {
                    "origin": "DEL",
                    "destination": "BOM",
                    "departureDate": "2014-03-26"
                }
            ],
            "noOfAdults": 1,
            "noOfChildren": 0,
            "noOfInfants": 0,
            "travelClass": "Economy",
            "showOnlyRefundableFlights": false,
            "showOnlyNonStopFlights": false,
            "hourRanges": null,
            "domain": null
        },
        "searchResults": {
		...
		

Open in new window

           I need to take out the value of response node... from which i need to pick out each of tripType , origin, destination, departureDate,....
            into local variables.
            
            How do i do it ?

Thanks
ASKER CERTIFIED SOLUTION
Avatar of chaitu chaitu
chaitu chaitu
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of CEHJ
Your  json actually defines a list of trips. What are you going to do about that?