-
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
Can't get key/value from hash #1810
Comments
Hello @johnaweiss.
Result:
|
So, if this is subAns Then name is Can an |
You're once again confusing between data structures. JS objects When Ruby hashes are iterated through, the data structure is an array of key-value pairs: So if you were to assess each pair, you see that |
I think you're saying that Liquid structures are JS objects are equivalent to Ruby Hashes, correct? |
Not at all. Regardless, let's drop that discussion.
Yes, we can either use the square-brackets or dot-notation syntax. The reason I outlined my comments with iteration was because your opening post focused on iteration and that it's the best way to render api structures as a whole via Liquid. Anyways coming back to your query, when given the following JSON: "comment" : {
"id": 123456,
"author": {
"username": "john_doe",
"email_id": "[email protected]"
},
"body": "Hello World!"
} Then, I could use Liquid to render comment-author details via either of the following:
|
@ashmaroli i sent a message to the email in your code. |
The doc states
"When iterating a hash, item[0] contains the key, and item[1] contains the value"
https://github.com/Shopify/liquid/wiki/Liquid-for-Designers
But i'm getting blanks.
I'm testing here:
https://pramodvalavala-msft.github.io/liquid-playground/
Template:
Data:
Output:
The text was updated successfully, but these errors were encountered: