I’m doing a Json parsing, in that i need to parse the "TStatus" key to show the tables.
In that TStatus key, the values are 3types. They are 100001, 100002, 100003.
I want only 100001 values nothing else… How to get these values and store it in array.
NSMutableArray *array = [arrayOfoccupiedTables valueForKey:@"TStatus"];
The response is
{
Msg = "";
TStatus = 100003;
"Table_Id" = 446;
},
{
Msg = "";
TStatus = 100001;
"Table_Id" = 447;
},
{
Msg = "";
TStatus = 100001;
"Table_Id" = 448;
},
{
Msg = "";
TStatus = 100001;
"Table_Id" = 449;
},
{
Msg = "";
TStatus = 100001;
"Table_Id" = 450;
},
{
Msg = "";
TStatus = 100001;
"Table_Id" = 451;
},
{
Msg = "";
TStatus = 100001;
"Table_Id" = 452;
},
{
Msg = "";
TStatus = 100003;
"Table_Id" = 453;
},
{
Msg = "";
TStatus = 100001;
"Table_Id" = 454;
},
{
Msg = "";
TStatus = 100001;
"Table_Id" = 455;
},
{
Msg = "";
TStatus = 100001;
"Table_Id" = 456;
},
{
Msg = "";
TStatus = 100001;
"Table_Id" = 457;
},
{
Msg = "";
TStatus = 100001;
"Table_Id" = 458;
},
{
Msg = "";
TStatus = 100001;
"Table_Id" = 459;
},
{
Msg = "";
TStatus = 100001;
"Table_Id" = 460;
},
{
Msg = "";
TStatus = 100001;
"Table_Id" = 461;
},
{
Msg = "";
TStatus = 100001;
"Table_Id" = 462;
},
{
Msg = "";
TStatus = 100003;
"Table_Id" = 463;
},
{
Msg = "";
TStatus = 100001;
"Table_Id" = 464;
},
{
Msg = "";
TStatus = 100001;
"Table_Id" = 465;
},
{
Msg = "";
TStatus = 100001;
"Table_Id" = 466;
},
{
Msg = "";
TStatus = 100001;
"Table_Id" = 467;
},
{
Msg = "";
TStatus = 100001;
"Table_Id" = 468;
},
{
Msg = "";
TStatus = 100001;
"Table_Id" = 469;
},
{
Msg = "";
TStatus = 100001;
"Table_Id" = 470;
},
{
Msg = "";
TStatus = 100001;
"Table_Id" = 471;
},
{
Msg = "";
TStatus = 100001;
"Table_Id" = 472;
},
{
Msg = "";
TStatus = 100001;
"Table_Id" = 473;
},
{
Msg = "";
TStatus = 100001;
"Table_Id" = 474;
},
{
Msg = "";
TStatus = 100001;
"Table_Id" = 477;
},
{
Msg = "";
TStatus = 100001;
"Table_Id" = 478;
},
{
Msg = "";
TStatus = 100001;
"Table_Id" = 479;
}
)
Plz help me out of this guys… Thanks in advance
You have to filter array using NSPredicate.
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"TStatus == 100001"];NSArray *filtered = ["Your Array" filteredArrayUsingPredicate:predicate];in filtered array you get value where Tstatus = 100001;