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

ConvertFrom-Json allows trailing commas in input JSON #11117

Closed
simonsabin opened this issue Nov 19, 2019 · 5 comments
Closed

ConvertFrom-Json allows trailing commas in input JSON #11117

simonsabin opened this issue Nov 19, 2019 · 5 comments
Labels
Issue-Question ideally support can be provided via other mechanisms, but sometimes folks do open an issue to get a Resolution-Duplicate The issue is a duplicate.

Comments

@simonsabin
Copy link

Convertfrom-json and Test-Json both accept invalid json and neither provide ability to force strict parsing.

It looks like there are two related issues on NJsonSchame and NewtonSoft.Json the latter saying its expected behaviour.

RicoSuter/NJsonSchema#942
JamesNK/Newtonsoft.Json#818

Steps to reproduce

convertfrom-json "{'simon':'sabin',}"

Expected behavior

An error should occur as in Powershell 5.x

Actual behavior

Parses correctly and returns object matching the json

Environment data

Name                           Value
----                           -----
PSVersion                      6.2.3
PSEdition                      Core
GitCommitId                    6.2.3
OS                             Microsoft Windows 10.0.18362
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
@simonsabin simonsabin added the Issue-Question ideally support can be provided via other mechanisms, but sometimes folks do open an issue to get a label Nov 19, 2019
@iSazonov
Copy link
Collaborator

The cmdlets is based on Newtonsoft.Json and inherit the behavior.

I see no reason to do something until we migrate to System.Text.Json.

@simonsabin
Copy link
Author

I realise that, this was more of a put it there so folks can hopefully find the information to understand the behaviour

@iSazonov
Copy link
Collaborator

I think we need a request to enhance the cmdlets with new parameter or parameters to support "options". This will be more useful for tracking.

@chriskuech
Copy link

Dup of #10628

@iSazonov iSazonov added the Resolution-Duplicate The issue is a duplicate. label Nov 20, 2019
@ghost
Copy link

ghost commented Nov 21, 2019

This issue has been marked as duplicate and has not had any activity for 1 day. It has been closed for housekeeping purposes.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Question ideally support can be provided via other mechanisms, but sometimes folks do open an issue to get a Resolution-Duplicate The issue is a duplicate.
Projects
None yet
Development

No branches or pull requests

3 participants