close
Skip to content

Fixed parsing of json maps#1

Merged
swissspidy merged 8 commits intowp-cli:masterfrom
robfelty:master
Mar 12, 2026
Merged

Fixed parsing of json maps#1
swissspidy merged 8 commits intowp-cli:masterfrom
robfelty:master

Conversation

@robfelty
Copy link
Copy Markdown

Valid YAML such as the following is not correctly parsed by the Spyc fork used in wp-cli. If you validate the following with other YAML validators such as yamllint.com, it is returned as valid Yaml.

key: {"json_key":"json_value", "json_key2": "json_value2"}

This should be represented in PHP as:

  'key' =>
  array (
    'json_key' => 'json_value',
    'json_key2' => 'json_value2',
  ),
)

However, when running through the Spyc.php implementation, the following is returned:

array (
  'key' =>
  array (
    0 => 'json_key":"json_value',
    1 => 'json_key2": "json_value2',
  ),
)

This can be tested by running one of the example scripts

cd examples
php yaml-load.php

I have added two additional tests in the spyc.yaml file to test this issue. If you run the example yaml-load.php script you will see that they are handled correctly and all of the existing examples are unchanged.

@swissspidy swissspidy requested a review from a team July 11, 2024 18:33
@swissspidy swissspidy requested a review from Copilot November 2, 2025 14:01

This comment was marked as resolved.

swissspidy and others added 5 commits November 2, 2025 16:38
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@swissspidy

This comment was marked as resolved.

gemini-code-assist[bot]

This comment was marked as resolved.

@swissspidy swissspidy self-requested a review March 12, 2026 08:49
@swissspidy swissspidy merged commit b8ab308 into wp-cli:master Mar 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants