JsonSpread
Introduction #
JsonSpread
helps to decode json string column and then spread its values into multiple columns. This process is very useful when you want to make calculation bases on the value inside json string.
Example #
<?php
use \koolreport\processes\JsonSpread;
class MyReport extends \koolreport\KoolReport
{
public function setup()
{
...
->pipe(new JsonSpread(array(
"address","jobs" //List of all json-type column name
)))
...
}
}
Code explanation:
- In this example, we use
JsonSpread
process with two columns name input"address"
and"jobs"
. These two columns contain json data in string format. - After being piped though the
JsonSpread
process, json string will be decoded and spread out to become columns. You will have columns like"addresss.city"
,"address.country"
Get started with KoolReport
KoolReport will help you to construct good php data report by gathering your data from multiple sources, transforming them into valuable insights, and finally visualizing them in stunning charts and graphs.