Sha256: 423dfd97e923b72f28276be87da5e7264e012db5c4df07d80363afea305bc857

Contents?: true

Size: 1.69 KB

Versions: 23

Compression:

Stored size: 1.69 KB

Contents

# Prevent unformatted parse_json tags (`ParseJsonFormat`)

_Version 1.9.0+_

This check exists to ensure the JSON in your parses is pretty.

It exists as a facilitator for its auto-correction. This way you can right-click fix the problem.

## Examples

The following examples contain code snippets that either fail or pass this check.

### ✗ Fail

```liquid
{% parse_json my_json %}
{
  "locales": {
"en": {
  "title": "Welcome", "product": "Product"
},
          "fr": { "title": "Bienvenue", "product": "Produit" }
  }
}
{% endparse_json %}
```

### ✓ Pass

```liquid
{% parse_json my_json %}
{
  "locales": {
    "en": {
      "title": "Welcome",
      "product": "Product"
    },
    "fr": {
      "title": "Bienvenue",
      "product": "Produit"
    }
  }
}
{% endparse_json %}
```

## Options

The following example contains the default configuration for this check:

```yaml
ParseJsonFormat:
  enabled: true
  severity: style
  start_level: 0
  indent: '  '
```

| Parameter | Description |
| --- | --- |
| enabled | Whether the check is enabled. |
| severity | The [severity](https://documentation.platformos.com/developer-guide/platformos-check/platformos-check#check-severity) of the check. |
| start_level | The indentation level. If you prefer an indented parse_json, set this to 1. |
| indent | The character(s) used for indentation levels. |

## Disabling this check

 This check is safe to disable. You might want to disable this check if you do not care about the visual appearance of your parse_json tags.

## Resources

- [Rule source][codesource]
- [Documentation source][docsource]

[codesource]: /lib/platformos_check/checks/parse_json_format.rb
[docsource]: /docs/checks/parse_json_format.md

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
platformos-check-0.4.12 docs/checks/parse_json_format.md
platformos-check-0.4.11 docs/checks/parse_json_format.md
platformos-check-0.4.10 docs/checks/parse_json_format.md
platformos-check-0.4.9 docs/checks/parse_json_format.md
platformos-check-0.4.8 docs/checks/parse_json_format.md
platformos-check-0.4.7 docs/checks/parse_json_format.md
platformos-check-0.4.6 docs/checks/parse_json_format.md
platformos-check-0.4.5 docs/checks/parse_json_format.md
platformos-check-0.4.4 docs/checks/parse_json_format.md
platformos-check-0.4.3 docs/checks/parse_json_format.md
platformos-check-0.4.2 docs/checks/parse_json_format.md
platformos-check-0.4.1 docs/checks/parse_json_format.md
platformos-check-0.4.0 docs/checks/parse_json_format.md
platformos-check-0.3.3 docs/checks/parse_json_format.md
platformos-check-0.3.1 docs/checks/parse_json_format.md
platformos-check-0.3.0 docs/checks/parse_json_format.md
platformos-check-0.2.2 docs/checks/parse_json_format.md
platformos-check-0.2.1 docs/checks/parse_json_format.md
platformos-check-0.2.0 docs/checks/parse_json_format.md
platformos-check-0.1.0 docs/checks/parse_json_format.md