Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #393 - JsonToYaml error on json array #433

Merged
merged 4 commits into from Mar 4, 2022
Merged

Fixes #393 - JsonToYaml error on json array #433

merged 4 commits into from Mar 4, 2022

Conversation

btiteux
Copy link
Collaborator

@btiteux btiteux commented Mar 2, 2022

fixes bug when trying to convert json with root array.

Pull request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • UI change (please include screenshot!)
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Internationalization and localization
  • Other (please describe):

What is the current behavior?

The JsonToYaml tool show an error when the user type the following yaml:

- key: value
  key2: 1
- key: value2
  key2: 2

image

Issue Number: #393

Without issue created the same tool can't convert the following json:

[
  {
    "key": "value",
    "key2": 1
  },
  {
    "key": "value2",
    "key2": 2
  }
]

image

What is the new behavior?

The JsonToYaml tool doesn't show an error when the user type the following yaml:

- key: value
  key2: 1
- key: value2
  key2: 2

image

The JsonToYaml tool can convert the following json

[
  {
    "key": "value",
    "key2": 1
  },
  {
    "key": "value2",
    "key2": 2
  }
]

image

Other information

Quality check

Before creating this PR, have you:

  • Followed the code style guideline as described in CONTRIBUTING.md
  • Verified that the change work in Release build configuration
  • Checked all unit tests pass

fixes bug when trying to convert json with root array.
@veler
Copy link
Collaborator

veler commented Mar 3, 2022

Looks great! Worth adding a test for it? 🤔


return false;
}
//private bool ConvertJsonToYaml(string input, out string output)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hum, why not removing this?

@veler veler merged commit 5bf4783 into main Mar 4, 2022
@veler veler deleted the bug/yaml-to-json branch March 4, 2022 07:34
veler pushed a commit that referenced this pull request Mar 31, 2023
* fixes bug #393
fixes bug when trying to convert json with root array.

* Moved JsonToYaml Converter Method to JsonHelper and YamlHelper

* cleanup commented code and added unit test

* removed commented code
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.

None yet

2 participants