Json root as array fails R# validation

Microsoft Visual Studio Community 2022
Version 17.2.3
VisualStudio.17.Release/17.2.3+32526.322
Microsoft .NET Framework
Version 4.8.04084

Installed Version: Community

JetBrains ReSharper 2022.1.1 Build 221.0.20220428.93142 built on 2022-04-28
dotCover 2022.1.20220428.101210
dotTrace 2022.1.20220428.101234
ReSharper 2022.1.20220428.100255
dotMemory 2022.1.20220428.101234

.NET Core Debugging with WSL   1.0
.NET Core Debugging with WSL

ASP.NET and Web Tools 2019   17.2.392.13739
ASP.NET and Web Tools 2019

Azure App Service Tools v3.0.0   17.2.392.13739
Azure App Service Tools v3.0.0

Azure Functions and Web Jobs Tools   17.2.392.13739
Azure Functions and Web Jobs Tools

C# Tools   4.2.0-4.22252.24+47cdc16a21bbb8a4aadfb666b011e2059e1be5d2
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Common Azure Tools   1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Microsoft JVM Debugger   1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

NuGet Package Manager   6.2.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

Razor (ASP.NET Core)   17.0.0.2218101+885a343b00bcab620a90c1550c37dafd730ce984
Provides languages services for ASP.NET Core Razor.

SQL Server Data Tools   17.0.62204.01010
Microsoft SQL Server Data Tools

TypeScript Tools   17.0.10418.2001
TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools   4.2.0-4.22252.24+47cdc16a21bbb8a4aadfb666b011e2059e1be5d2
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools   17.1.0-beta.22253.3+058e7a7e597a02c129f38742f250a4b212da9ee3
Microsoft Visual F# Tools

Visual Studio IntelliCode   2.2
AI-assisted development for Visual Studio.

VSColorOutput64   2022.2
Color output for build and debug windows - https://mike-ward.net/vscoloroutput

 

R# is reporting JSON structures with an array as the root element as invalid: "JSON validation failed: Expression must be of type 'object'."

Example:

[
  {
    "prop1": "",
    "prop2": "",
    "prop3": ""
  }
]

Is there a reason why R# considers an array as the root object of a JSON structure as invalid?

 

 

0
4 comments
Official comment

Hello,

This happens to be a known issue - https://youtrack.jetbrains.com/issue/RSRP-464833.

You are welcome to comment or vote for it.

Thank you.

The linked issue is from 5 years ago. However, this issue appears to have surfaced in VS 2022. In VS 2019/17, the same JSON is not marked as invalid by R#.

Why would this be a known issue from 5+ years ago that is only present in VS 2022, but not the prior 2 or 3 versions?

0

Hello,

 

Sorry for the delay in responding.

Could you please provide some sample solution in whicht the problem is reproduced? Please also provide screenshots how it looks for you in VS 2022 and VS 2019.

Thank you.

0

Well, I provided the sample JSON that was failing a few months ago. The latest updates to R# seems to fixed the issue, yet again.

0

Please sign in to leave a comment.