Skip to content

Arrays are being transformed into objects #14

@rbrlortie

Description

@rbrlortie

When running deep-object-diff on an object which contains arrays those arrays are turned into objects.

Object on which deep-object-diff is used:

{
    "Order": [{
        "OrderLines": [{
            "canEditQty": true,
            "ProductId": "1234",
            "ProductCode": "sku-1234",
            "QtyAvailable": "5",
            "QtyOrdered": "5",
            "QtyInvoiced": "0",
            "QtyShipped": "5",
            "QtyInitialBo": "0",
            "QtyBo": "0",
            "Total": 6.8,
            "Price": 1.36,
            "PriceText": "$1.36",
            "PriceMatchStatus": 0,
            "OriginalPrice": 1.36,
            "OriginalPriceText": "$1.36",
            "IsPriceMatch": false
        }]
    }]
}

Those values are changed to :
QtyOrdered: "7"
Total: "9.52"
Price: "1.36"

Result of deep-object-diff:

{
    "Order": {
        "0": {
            "OrderLines": {
                "0": {
                    "QtyOrdered": "7",
                    "Total": "9.52",
                    "Price": "1.36"
                }
            }
        }
    }
}

This creates issues where we expect some data to be arrays and they are now objects.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions