<?php
$cart = array(
"orderID" => 12345,
"shopperName" => "Ваня Иванов",
"shopperEmail" => "ivanov@example.com",
"contents" => array(
array(
"productID" => 34,
"productName" => "Супер товар",
"quantity" => 1
),
array(
"productID" => 56,
"productName" => "Чудо товар",
"quantity" => 3
)
),
"orderCompleted" => true
);
echo json_encode( $cart );
?>
$test = array();
foreach($products as $product){
$test[] = array(
"id"=>$product->id,
"title"=>$product->title,
"param"=>array(
"param1"=>21,
"param2"=>2,
),
);
}
echo json_encode($test);