ios - How to retain order of JSON data retrieved with AFNetworking? -
i using afnetworking
retrieve json data web service. part of response string is:
{"data":{"lease type":"3 yrs + 0 renew of 0 yrs","landlord":"","tenant":"test comp"...
and on. order of key values in "data" dictionary ("lease type","landlord","tenant"...) important presentation purposes. however, when afnetworking
calls nsjsonserialization's
:
+ (id)jsonobjectwithdata:(nsdata *)data options:(nsjsonreadingoptions)opt error:(nserror **)error;
method, returned dictionary has keys in different order.
i notice afjsonrequestoperation
object has server's response stored nsstring
, in correct order. i'm not keen on parsing json hand if can avoid it.
can suggest way let me @ / keep keys in original order?
thanks.
if order important use array not dictionary, dictionaries nature unordered. or add array of dictionary keys in order desired.
if have no control on response sent have parse json @ least ordering.
Comments
Post a Comment