i have following issue:
i make call rest api. returns json data. need on client process data , (doesn't matter what).
i can either decode json object, or associative array. there practices saying should go 1 way or (with solid reasons behind them)?
personally i'm inclined towards object, in cases may not best choice (for example when there numerical indexed array encoded in json, decoded array inside object, i'm ending 2 types of data - not big problem, bit inconvenient).
json/javascriptecmascript delineates between objects , arrays (as many other languages, call them lists , dictionaries, or hashes, or whatever). objects unordered key-value pairs, while arrays ordered numerically indexed containers.
php doesn't make distinction in arrays, php's arrays ordered key-value pairs allowing numeric keys. php also happens have concept of objects. json_decode offers way want map ambiguous data types. it's entirely you.
there's not lot can stdclass objects, while arrays flexible data structures tons of manipulation functions. take pick. largely doesn't matter.
Comments
Post a Comment