I have this array, is stored in a variable called $ data :
Array
(
[0] => Array
(
[Code] => DES001
[Commennte] =>
[Quantity] => 1
[Price] => 135.00
[Unity] => 1
)
)
and i want to add to another variable to send to an API
$body = '<request>
<method><![CDATA[registra]]></method>
<param>
<name><![CDATA[pedido]]></name>
<value><![CDATA[{"Pedido":
{
"Nombre":"",
"Producto":{
"Product":"'.$datos.'"
}
}
}
]]>
</value>
</param>
</params>
</request>';
but when i echo $body the result its like this:
"Product":{
"Product":"Array"
}
how can I add the string to have an output like this:
"Product":{
"Product":[
{"ClaveProducto":"DES001",
"Cantidad":"1",
"Precio":"135",
"Unidad":"PIEZA",
"Comentario":""
}]
thanks to all