when i send a request i got here response:
{
data = {
deviceShareSet = (
);
id = 4028814062666bf90162666c09b10000;
locations = (
);
password = hehe;
phone = 17520440116;
token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ4amtqIiwiZXhwIjoxNTI3NDEyMjY5LCJ1c2VySUQiOiI0MDI4ODE0MDYyNjY2YmY5MDE2MjY2NmMwOWIxMDAwMCJ9.hjfUchx2QQEZ2PrQ-pstwkPELpZ76oQRX7-vGb4CwLk";
userRelationships = (
);
};
status = {
code = 1;
haveNext = 0;
message = "\U767b\U5f55\U6210\U529f";
};
}
my code:
provider.rx
.request(.Login(data, message, aesIV.ivCode))
.mapJSON().subscribe {
switch $0 {
case .success(let data):
print(data)
case .error(_):
break
}
}
.disposed(by: disposeBag)
i can print the data, but i can' use like this data["data"]
Type 'Any' has no subscript members
then i use like this
let dic = data as! [String: String]
// let dic = data as! [String: [String: String]]
it will crash
Hey @lSkyPivot, what about let dictionary = data as? [String: Any]?
@BasThomas It works, thanks a lot
Most helpful comment
@BasThomas It works, thanks a lot