Skip to content

Json: How to handle not existing member #952

@paule96

Description

@paule96

Currently, I am trying to implement a maybe weird case in my internal project. The basic concept is that any JSON object can be part of a JSON array.

So something like that:

[
   {
      "animal": "cat"
   },
   {
      "color": "green"
   }
]

If I now try to run something like that:

JsonDocument data = null; // something sets the value of JsonDocument so it's not null
data.Any(config: System.Linq.Dynamic.Core.SystemTextJson.Config.SystemTextJsonParsingConfig.Default, "x => x.number == 5"));

I will now get an exception like that:

The binary operator Equal is not defined for the types 'System.Object' and 'System.Int32'.

My question is, is there some kind of expression that I can write, that makes it possible to make a member optional?

Or some setting that I can set?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions