Advertisement
kromm77

Json to PHP associative array

Oct 9th, 2015
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.33 KB | None | 0 0
  1. <?php
  2. ## JSON : an object with attribute with key name and values as value
  3. $json = '
  4.          {
  5.             "key": "value",
  6.             "key2": "value2"
  7.          }
  8. ';
  9. $assoc = true;
  10. $result = json_decode ($json, $assoc);
  11. ?>
  12.  
  13. ##$result (php code):
  14.  
  15. <?php
  16. array (
  17.   'key' => 'value',
  18.   'key2' => 'value2',
  19. );
  20. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement