-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Printing / Echoing / Dumping Arrays #121
Comments
Stumbled upon the filter {{ variable | json }} and it works like a charm. |
Good one :) |
Thanks it worked 👍 |
It doesn't work with everything... |
Here's how I do it Create a snippet named "dump.liquid" with the following code snippet
Usage in template files: Example: Used within product.liquid template file Open Chrome console and you will see an object that you can drill into and explore. |
For {{ linklists | json }} it throws {"error":"json not allowed for this object"}. |
Very useful but how do you format the output? |
I'm still looking for a way to get pass the "not allowed for this object" issue. |
still no response for debug dumping variant metafields |
{{ variableName | pprint }} |
This is Shopify liquid. |
thanks @tdhatcher - this is the most elegant solution I found for this |
I'm looking for a way in liquid to see what something has before looping it. I'm working with shopify and I hate to have to consult the docs to see what is inside the array "product" I would love to be able to just
{{product}}
and see some kind of messy array with key value pairs (json would be nice) that I can visually parse and understand. I work a lot with php and javascript and usevar_dump()
andconsole.log()
excessively and it bothers me that in liquid there is no way to see what is going on within an array. Why hasn't this been built into liquid? or if it has, could someone please share?The text was updated successfully, but these errors were encountered: