json liquid error

Topic summary

A user is encountering a JSON parsing error in Shopify Liquid code when implementing structured data for rich results. The error message indicates “Missing ‘,’ or ‘}’” and occurs specifically at the line containing {% if product.rating_count > 0 %}.

Key details:

  • The problematic code appears to be for aggregate rating schema markup
  • The error occurs in Google’s Rich Results Test
  • Variables like product.rating_count, product.average_rating, and product.compare_at_price are being used

Current status:

  • Another user asked for clarification about whether the variables are properly defined and accessible
  • The original poster confirmed the variables are accessible but the parsing error persists
  • The issue remains unresolved, with the conversation appearing to be in early troubleshooting stages
Summarized with AI on November 8. AI used: claude-sonnet-4-5-20250929.

i am having error with my json always give me error when i put in rich test result {% if product.compare_at_price > 0 %} and this {% if rating_count > 0 or product.reviews.size > 0 %},{% endif %} can anyone help me

Hi,

Are variables defined and accessible?

yes it’s always that same error in rich result test saying Parsing error: Missing ‘,’ or ‘}’ :

},
{% if product.rating_count > 0 %} ----ERROR line
“aggregateRating”: {
@type”: “AggregateRating”,
“ratingValue”: “{{ product.average_rating }}”,
“reviewCount”: “{{ product.rating_count }}”