Shopify / Shopify/liquid

How to parse JSON in liquid template

Open
#1,415 2 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
11.9k
Forks
1.5k
Avg merge
17h 55m
Merged PRs (30d)
3

Description

In the JSON data, I am having serialize JSON data in a field.

How can I deserialize the JSON string and print it?

For Example :

{
"property1" : "ABC",
"property2": "{"firstname":"Shubham","lastname":"Dhanetia","dob":"2021-02-28T18:30:00Z"}"
}

How can we print the first name and last name from the field "property2" in the liquid template?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the JSON example and the requested Liquid output in the issue, then inspect the existing Liquid documentation for parsing and nested field access. Done means documenting a supported approach for printing the first and last names, or clearly recording the relevant limitation.

Written by the indexing model from the issue text.

Assessment

Tech stack
json, ruby
Domain
documentation
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.