PHP code example of jsonmodifier / json

1. Go to this page and download the library: Download jsonmodifier/json library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jsonmodifier / json example snippets

 php
// Import vendor/autoload file
struct method take one argument which is the JSON file path.
$json = new PhpJsonModifier\JsonModifier('json/items.json');

// Start performing your operations.
$data = $json->index('items')
             ->get();
 php
$data = $json->index('items')
             ->get();
 php
// Update item unitprice and color where "item_id" = 3
$update = $json->index('items')
               ->update(
                   array('item_id', '3'), // condition (WHERE item_id = 3)
                   array(
                        ['item_unitprice' => '224.50'],
                        ['item_color' => '#fff']
                   )
);