I am trying to parse out a int value in the variable but its returning nil or 0 The value I want is from the customer_group_id. I am using swift. I have parsed out other information from the json file, but it keeps messing up at this stage.
print("My Loyalty rank: " , newJson["loyalty_rank"][0]["customer_group_id"].string)
myRank = newJson["loyalty_rank"][0]["customer_group_id"].intValue
Here is the json file
{ "id":298,
"name":"桃子 桜",
"total_points_earned":164,
"points_available_to_spend":164,
"loyalty_rank":{
"customer_group_id":9,
"name":"Baby Bee",
"ratio":1
},
"order_history":[
{ }
],
"barcode_id":"C-00000298"
}