PHP: access object with key int

mwafi

I receive jsons in this format:

{"106371527":[33,22,11,2],"10003989":[3,2,11,3]}

note: 106371527,10003989 users ids

when I use json_decode(), still can't access data because the object keys is int,

how to fix this?

thanks,

Cyclonecode

You should also be able to access the property by wrapping it in {}:

$json = '{"106371527":[33,22,11,2],"10003989":[3,2,11,3]}';
$object = json_decode($json);
print_r($object->{106371527});

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

How to access a key object in jQuery with "/"

분류에서Dev

Access key from object that is being created

분류에서Dev

setTag (int key, Object tag) 메서드의 NumberFormatException

분류에서Dev

setTag (int key, Object tag) 메서드의 NumberFormatException

분류에서Dev

access json object returned from php file via ajax

분류에서Dev

How to access PDO connection object across multiple class?[php +Mysql]

분류에서Dev

Cannot access key in dictionary

분류에서Dev

How to access attributes of php object inside a array of php objects from javascript

분류에서Dev

Use shortcut key as Access key in a web page

분류에서Dev

Giving int values to key in an array

분류에서Dev

Access to a "parent" object

분류에서Dev

can not access the array of an object

분류에서Dev

Ember Object attribute access

분류에서Dev

DSum Object Required in Access

분류에서Dev

MongoDB - Query on key name of an object

분류에서Dev

Check id of foreign key object

분류에서Dev

DataTable object initializer with Primary Key

분류에서Dev

Sorting array of object by specific key

분류에서Dev

Javascript object property: string or int?

분류에서Dev

How to access a var with "-" in PHP

분류에서Dev

PHP access system - OR in function

분류에서Dev

JSF Access control on direct object

분류에서Dev

Access json value of current object

분류에서Dev

MS Access query table without primary key

분류에서Dev

How to access generated key for clojure jdbc insert

분류에서Dev

Access value from tuple by key in python

분류에서Dev

Merge a php array and a php object

분류에서Dev

runtime vector<int> STATUS_ACCESS_VIOLATION

분류에서Dev

Array key as variable in foreach - PHP