Skip to content

extra null in array #8

@petershaw

Description

@petershaw

I merge this 5 objects to one:

{"weather":{"place":"Passau"}}

{"weather":{"temperature":{"value":"13","unit":"°C","conditions":"05"}}}

{"weather":{"forcastday":[{"temperatureMax":"18.3","temperatureMin":"13.2","unit":"°C","conditions":"09","day":"2016-07-02T22:00:00+00:00P1D"}]}}

{"weather":{"forcastday":[{"temperatureMax":"22","temperatureMin":"14","unit":"°C","conditions":"02","day":"2016-07-03T22:00:00+00:00P1D"}]}}

{"weather":{"forcastday":[{"temperatureMax":"24.2","temperatureMin":"15.4","unit":"°C","conditions":"02","day":"2016-07-04T22:00:00+00:00P1D"}]}}

with:

data = myExtend.apply(this, data);

The result has an extra null in the array:

{"weather":{"place":"Passau","temperature":{"value":"14","unit":"°C","conditions":"05"},"forcastday":[null,{"temperatureMax":"18.3","temperatureMin":"13.2","unit":"°C","conditions":"09","day":"2016-07-02T22:00:00+00:00P1D"},{"temperatureMax":"22","temperatureMin":"14","unit":"°C","conditions":"02","day":"2016-07-03T22:00:00+00:00P1D"},{"temperatureMax":"24.2","temperatureMin":"15.4","unit":"°C","conditions":"02","day":"2016-07-04T22:00:00+00:00P1D"}]}}

See the "forcastday":[null,{"temperatureMax": section.

I can quick fix it for this example, when i reverse the data array:

data = myExtend.apply(this, data.reverse());

But this in not a solution, because i don't know how the array is structured. How can I fix the extra null?

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