Skip to content

Bug report: Error thrown when parsing JSON output of spo sites classic list command #1266

@garrytrinder

Description

@garrytrinder

Description

Error is thrown when executing o365 spo site classic list -o json command and attempting the parse the output in bash and PowerShell Core

Steps to reproduce

Bash: Execute o365 spo site classic list -o json | jq
PowerShell Core: o365 spo site classic list -o json | ConvertFrom-Json

Expected result

JSON should be parsed

Actual result

Error is thrown

bash
parse error: Unfinished string at EOF at line 1, column 65536

PowerShell Core

ConvertFrom-Json : Conversion from JSON failed with error: Unterminated string. Expected delimiter: ". Path '[28].RestrictedToRegion', line 1, position 65534.
At line:1 char:38
+ o365 spo site classic list -o json | ConvertFrom-Json
+                                      ~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (:) [ConvertFrom-Json], ArgumentException
+ FullyQualifiedErrorId : System.ArgumentException,Microsoft.PowerShell.Commands.ConvertFromJsonCommand

Environment

MacOS Catalina, bash, 2.4.0
Ubuntu 18.04, bash, 2.3.0

Additional Info

This is not an issue on Windows 10 when using the standard PowerShell ConvertTo-Json cmdlet, so it would appear that this is only an issue on Unix based systems.

Executing o365 spo site classic list -o json command displays the full JSON response in the terminal window as you would expect.

It is possible to redirect the JSON output the file system in bash by executing o365 spo site classic list -o json > output.json, the resulting output file contains full JSON output which is displayed in the terminal window stored on a single line. However executing the same command in PowerShell Core results the output file containing a truncated version of the JSON output.

In both bash and PowerShell Core, assigning the JSON output directly to a variable results in the variable containing truncated JSON output which is invalid JSON.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions