PAD Showcase
All tags/JSON viewer

A PHP array

A page array shown as the JSON it would be - one level open, so the sections show folded with their sizes until clicked.

1 The data jsonview/config.php php
<?php

  // The settings of a shop, as the page's PHP holds them.

  $settings = [
    'shop'     => [ 'name' => 'Mini Wheels Co.', 'currency' => 'EUR', 'locales' => [ 'en', 'nl', 'de' ] ],
    'mail'     => [ 'transport' => 'smtp', 'host' => 'mail.example.com', 'port' => 587, 'tls' => TRUE ],
    'cache'    => [ 'pages' => TRUE, 'ttl' => 600, 'store' => 'apcu' ],
    'features' => [ 'reviews' => TRUE, 'wishlist' => FALSE, 'giftcards' => NULL ],
    'version'  => '3.0.2',
  ];

?>
2 The tag jsonview/config.pad pad
{jsonview $settings, open=1, title='settings'}
3 The result rendered on the server
settings {…} 5 keys
  • "shop": {…} 3 keys
    • "name": "Mini Wheels Co."
    • "currency": "EUR"
    • "locales": […] 3 items
      • 0: "en"
      • 1: "nl"
      • 2: "de"
      ]
    }
  • "mail": {…} 4 keys
    • "transport": "smtp"
    • "host": "mail.example.com"
    • "port": 587
    • "tls": true
    }
  • "cache": {…} 3 keys
    • "pages": true
    • "ttl": 600
    • "store": "apcu"
    }
  • "features": {…} 3 keys
    • "reviews": true
    • "wishlist": false
    • "giftcards": null
    }
  • "version": "3.0.2"
}