segment-boneyard / analytics-magento

[DEPRECATED] The hassle-free way to integrate analytics into any Magento store.
15 stars 19 forks source link

JSON encode arrays #5

Closed ianstormtaylor closed 10 years ago

ianstormtaylor commented 10 years ago

Instead of using sprintf to create the JSON dictionaries, I think we would get simpler code if we used the json_encode method. There's an example of that from our WordPress library here. That way we could just do:

$properties = array(
  'id' => $order->getEntityId(),
  'total' => $order->getGrandTotal(),
  'tax' => $order->getTaxAmount()
);

$string = json_encode($properties)

Do you guys see any problems with that?

yaro-atwix commented 10 years ago

Sure, it makes sense. Will do that.