Can't get key/value from hash
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 11.9k
- Forks
- 1.5k
- Avg merge
- 17h 55m
- Merged PRs (30d)
- 3
Description
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:
{
{%- for item in answers -%}
{%- assign oSubAnswers = item.answer -%}
{{oSubAnswers}}
{%- for subAns in oSubAnswers -%}
{{ subAns[0] }}: {{ subAns[1] }}
{%- endfor -%}
{%- endfor -%}
}
Data:
{
"answers": {
"12": {
"answer": {
"field_1": "John",
"field_3": "White",
"field_5": 1111111,
"field_4": "111-111-1111"
}
},
"22": {
"answer": {
"field_2": "111 Ventura Blvd",
"field_3": "111-111-1111",
"field_8": "johnawhite@gmail.com",
"field_7": "https://tort.xyz",
"field_6": "10 am to 6 pm, M-F"
}
}
}
}
Output:
{
[field_1, John][field_3, White][field_5, 1111111][field_4, 111-111-1111][itemName, answer]
:
:
:
:
:
[field_2, 111 Ventura Blvd][field_3, 111-111-1111][field_8, johnawhite@gmail.com][field_7, https://tort.xyz][field_6, 10 am to 6 pm, M-F][itemName, answer]
:
:
:
:
:
:
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the template and data in the linked Liquid Playground, then compare the observed iteration behavior with the Liquid for Designers wiki statement. Determine whether the implementation or documentation is inconsistent, and consider the issue done when key/value access is either corrected or clearly documented for this input.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100