I need to parse below sample strings to get status and code and bind it to a struct "ErrorData".
String1 - ("{\n \"errors\" : [ {\n \"status\" : \"400\",\n \"code\" : \"INVALID_DATA\"\n } ]\n}")
String2 - "{\n \"errors\" : [ {\n \"status\" : \"404\",\n \"code\" : \"INVALID_AUTH\"\n } ]\n}")
public struct ErrorData {
var errorStatus: String?
var errorCode: String?
}
These are only 2 samples string, there will be many more strings of same format with different status and code value. How do I parse above string with format as shown above.