php - Fail on Decode my json string :( -


this question has answer here:

how decode php

$myjson = [{"type":"laser","material":"1","quantity":1000}, {"type":"motors","material":"1","quantity":1491477212}, {"type":"shield","material":"1","quantity":1491531189}, {"type":"hp","material":"1","quantity":1491531201}] ; 

check code, missed "'" in start , end "'". have format can use code

<?php $myjson = '[{"type":"laser","material":"1","quantity":1000},{"type":"motors","material":"1","quantity":1491477212},{"type":"shield","material":"1","quantity":1491531189},{"type":"hp","material":"1","quantity":1491531201}]' ; $array = json_decode($myjson);  echo "<pre>"; print_r($array); 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -