0

how decode it with 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}] ;
Bilal Ahmed
  • 4,005
  • 3
  • 22
  • 42
Steve
  • 1
  • 1

1 Answers1

0

check this code, you missed "'" in start and end "'". i have format it now you can use this 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);
Shafiqul Islam
  • 5,570
  • 2
  • 34
  • 43