Q:

How to get data from nested JSON using JSONDecoder in swift 4?

I am very new in swift, first of all I want to know what is the major difference between Encoding and Decoding. Secondly, I am try to get a particular value from the response as shown below:
 
I want to decode the value of gender_category and put it in piker, here is what i have done till now:
struct Gender: Decodable {

let result : [Result]

enum CodingKeys :String, CodingKey {
    case result
}

struct Result: Decodable {
    let genderCategory: String

    enum CodingKeys : String, CodingKey {

        case genderCategory = "gender_category"
    }
}
}

And my code to get response is this:
 func getGenderValueFromJSON()  {
    let url = URL(string: "http://www.----------.com/GenderList/get")
    URLSession.shared.dataTask(with: url!) { (data, response, error) in
        if error == nil{
            do{

                let result  = try JSONDecoder().decode(Gender.self, from: data!)
                print(result)
            }catch let error as NSError{

                print("Parse Error\(error)")
            }
        }

        }.resume()
}

I get my result in this way:
Gender(result: [something.Gender.Result(genderCategory: "Male"), something.Gender.Result(genderCategory: "Female"), something.Gender.Result(genderCategory: "Transgender"), something.Gender.Result(genderCategory: "Others")])
But how do I get only the value of genderCategory?

A:

result is an array of Result, not String
let result : [Result]

This are the structs decoding all keys
struct Gender: Decodable {

    let message : String
    let statusCode : Int
    let result : [Result]

    enum CodingKeys :String, CodingKey {
        case message, statusCode = "status_code", result
    }

    struct Result: Decodable {

        let genderCategory: String
        let id : String

        enum CodingKeys : String, CodingKey {
            case genderCategory = "gender_category", id
        }
    }
}

To get the gender_category values 
let gender = try JSONDecoder().decode(Gender.self, from: data!)
for item in gender.result {
    print(item.genderCategory)
}

