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

Multiple call #5

Open
BarryCarlyon opened this issue Apr 9, 2018 · 1 comment · May be fixed by #6
Open

Multiple call #5

BarryCarlyon opened this issue Apr 9, 2018 · 1 comment · May be fixed by #6

Comments

@BarryCarlyon
Copy link

Consider this:

{% for variant in product.variants %}
{% assign test = variant.sku %}

    {%- capture json_error -%}
        {%- include 'json_decode' jd__namespace:test jd__data:variant.metafields.sitestock.warehouse -%}
    {%- endcapture -%}
{% endfor %}

This results in the "second" call to json_decode to have the first key appended to the last key.

Something like:

whstock.display.manchester
whstock.display.leeds
whstock.display__keys
whstock.display__values
whstock.display
whstock.inventory.manchester
whstock.inventory.leeds
whstock.inventory__keys
whstock.inventory__values
whstock.inventory
whstock.bin.manchester
whstock.bin.leeds
whstock.bin__keys
whstock.bin__values
whstock.bin
whstock__keys
whstock__values
whstock
whstock__keys
whstock__valueswhstock.display.manchester
whstock.display.leeds
whstock.display__keys
whstock.display__values
whstock.display
whstock.inventory.manchester
whstock.inventory.leeds
whstock.inventory__keys
whstock.inventory__values
whstock.inventory
whstock.bin.manchester
whstock.bin.leeds
whstock.bin__keys
whstock.bin__values
whstock.bin
whstock__keys
whstock__values
whstock
whstock__keys
whstock__values

With

whstock__valueswhstock.display.manchester

Being the faulty key.

The first "item" in the JSON is having it's key trashed. I'm gonna see if I can find the fault and fix it with a PR. But opening this to track as we go

@BarryCarlyon
Copy link
Author

Input json:

{"display":{"manchester":"901","leeds":"1"},"inventory":{"manchester":"901","leeds":"1"},"bin":{"manchester":"Basement","leeds":""}}

BarryCarlyon pushed a commit to BarryCarlyon/shopify-json-parser that referenced this issue Apr 9, 2018
@BarryCarlyon BarryCarlyon linked a pull request Apr 9, 2018 that will close this issue
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

Successfully merging a pull request may close this issue.

1 participant