JsonLiteralQuoteStyle
JsonLiteralQuoteStyle
Severity: error | Type: LiquidHtml
Inline object and array literals in platformOS Liquid (e.g. {% assign a = {"a": 5} %}) must be valid JSON. Single-quoted strings are not valid JSON, so this check reports any single-quoted string used inside an inline object or array literal — whether as a key or as a value.
Single-quoted strings outside of object/array literals (e.g. {% assign s = 'hello' %}) are perfectly fine and are not reported.
Examples
✗ Incorrect Code Example (Avoid using this):
{% assign user = {'name': 'Anne'} %}
{% assign ids = ['a', 'b', 'c'] %}
{% assign mixed = {"count": 1, "label": 'items'} %}
✓ Correct Code Example (Use this instead):
{% assign user = {"name": "Anne"} %}
{% assign ids = ["a", "b", "c"] %}
{% assign mixed = {"count": 1, "label": "items"} %}
{% comment %}Single quotes outside JSON literals are fine:{% endcomment %}
{% assign greeting = 'hello' %}
Configuration
The default configuration for this check:
JsonLiteralQuoteStyle:
enabled: true
severity: error
Disabling This Check
This check should not be disabled — single-quoted strings inside inline object/array literals are not valid JSON.
Autofixing
This check supports automatic fixing. The fix replaces each single-quoted string with its double-quoted JSON equivalent (escaping the content where needed).