Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extra null in array #8

Open
petershaw opened this issue Jul 3, 2016 · 0 comments
Open

extra null in array #8

petershaw opened this issue Jul 3, 2016 · 0 comments

Comments

@petershaw
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant