python - can't figure out json elements result -
Server side execute a SQL query
Output is the result of the internal method and is already sorted in such a way:
output = serializers Consumer side received a successful response, Success: ^ (AFHTTPRequestOperation * operation, ID response Object) AFHTTPRequestOperationManager and this is what appears in the responseObject debug console (lldb)
po feedback object & lt; __ NSCFRA 0x116fa6190 & gt; ({Data = "[{\" pk \ ": 817, \" model \ ": \" xx \ ", \" fields \ ": {\" value \ ": \" 3300 \ ", \" publishdate \ ": \" 2014-10-30 to 00: 00: 00 \ ", \" size \ ": 35}}, {\" pk \ ": 2799, \" model \ ": \" xx \ ", "Fields \": {\ "price \": \ "6250 \", \ "Publishdate \": \ "2014-12-08T00: 00: 00 \", \ "size \": 0}}] "; Total = (381);}) In these console po response object [0] [@ "data"] [0] prints the data array and <
Problem:
- Trying to insert code into the
feedback object [0] [@ "total"] [0]trash in the whole Return the number - Casting
Feedback [0] [@ "Data"] [0]inNSArray *and then try to count or do any other operation Is causing an exception:'NSInvalidArgumentException', reason: '- [__ NSCFString count]: Unknown selector has been sent for example
The part of the problem may be that the description method does not cite all the strings, 381 is a string Could.
Positive Solution (Lack of OP Code):
If it is actually a int use:
int Value = responseObject [0] [@ "total"] [0] If it is actually a string :
NSString * valueString = responseObject [0] [@ "total"] [0] int value = [valueString intValue];
Comments
Post a Comment