Ver Mensaje Individual
  #1 (permalink)  
Antiguo 20/06/2019, 16:42
Novogt
 
Fecha de Ingreso: abril-2011
Ubicación: Az, EEUU
Mensajes: 6
Antigüedad: 13 años
Puntos: 0
Leer un Json con "0" (Cero)

Hola, tengo un Json que es el siguiente en una variable, todo va bien:

{"OrderNumber":"1822002","OrderDate":"2019-06-20T00:00:00","Customer":{"CustomerId":"ABC02820"," Name":"EJEMPLO S. A.","Company":{"Id":"XAA","Name":"Ejemplo"},"Count ry":{"Id":"RR","Name":"Ejemplo"},"Currency":{"Curr encyId":"dor","CurrencyCode":null,"Description":nu ll,"Symbol":null,"UsExchangeRate":null}},"Customer OrderNumber":null,"StoreOrder":{"StoreId":"ejemmpl o","StoreOrderNumber":"81-ABC131","Customer":null,"Billing":null,"Shipping": null,"DeliveryType":null,"CrossReferenceKey":null} ,"Items":[{"CouponCodes":null,"StoreItemId":null,"LineNumber ":1,"Product":{"Sku":"AC122KLX16","Mpn":"KFM-565","Description":"una descripción bastante grande, de mucho texto, hasta 800 x 600 mm","Type":"Physical","Manufacturer":{"Manufacture rId":"acv","Description":"Accvent"},"Brand":{"Manu facturerId":"acv","BrandId":"klx","Description":"K lip Xtreme"},"Category":{"CategoryId":"mon","Descripti on":"Monitores & Proyectores","Subcategories":[{"CategoryId":"mon.monacc","Description":"Accesori os","Subcategories":[]}]},"Freight":null,"ProductLine":"Klip Xtreme","Model":"KFM-565"},"Quantity":1,"LocationId":"xgt1","UnitPrice" :{"Amount":11.3996,"HomeAmount":null,"Currency":nu ll},"ExtendedPrice":{"Amount":11.4,"HomeAmount":nu ll,"Currency":null},"Comments":null,"Components":[],"ParentSku":null,"Discounts":{"Amount":null,"Home Amount":null,"Currency":null}}],"ItemCount":1,"CouponCodes":null,"TaxRegistration Number":null,"InvoiceRequested":false,"ReceiveInvo iceByMail":false,"Payments":null,"Shipments":null, "OnHold":true,"TotalPaymentsAmount":0.0,"Status":{ "StatusCode":"1","Description":"Open"},"Currency": {"CurrencyId":"dor","CurrencyCode":"$$$","Descript ion":"Dólares","Symbol":"$","UsExchangeRate":null} ,"Comments":null,"TaxRate":1.0,"OtherFees":"","Sub total":{"Amount":57.4,"HomeAmount":57.4,"Currency" :null},"Discounts":{"Amount":0.0,"HomeAmount":null ,"Currency":null},"Tax":{"Amount":6.89,"HomeAmount ":6.89,"Currency":null},"ShippingFee":{"Amount":0. 0,"HomeAmount":null,"Currency":null},"Total":{"Amo unt":57.4,"HomeAmount":57.4,"Currency":null},"Tag" :null,"PrintedInvoiceNumber":""}


He tomado las variables que necesito, así:

$NumeroOrden = Trim($info->OrderNumber);
$FechaOrden = Trim($info->OrderDate);
$DocumentoWay = Trim($info->StoreOrder->StoreOrderNumber);
$Producto = Trim($info->Items->0->Product->Description);

Pero $Producto, no lo puedo tomar, pues ese "Cero" me da error "->0", como puedo tomar la "Description" de éste Json ????? Que sintaxis puedo usar ??????

Gracias por su ayuda.

Saludos.