question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Is there any plan for supporting nullable JsonElements?

See original GitHub issue

If not is there any interest this functionality? I’d be happy to work on it. An example use case would be this:

public class Entity {
    public JsonElement? Property { get; set; }
}

var johns = context.Entities.Where(e => e.HasValue && e.Value.GetProperty("name").GetString() == "john");

You can currently work around this with the JsonExists extensions and an explicit cast, but it would be nice to have.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
rojicommented, Aug 8, 2020

@tommymh any luck with that repro?

1reaction
tommymhcommented, Jul 27, 2020

@roji thanks for the reply, I am actually using JsonExists to verify that a property inside the top level document exists, so that I can be sure it isn’t null(not ideal, I know). The error I’m getting is that the query can’t be translated to SQL and I should try client side evaluation, or something to that effect. I will try to remove my application specific business logic and put an example repo together that can reproduce the issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Include Null Values in JSON - SQL Server
In this article. To include null values in the JSON output of the FOR JSON clause, specify the INCLUDE_NULL_VALUES option. If you don't...
Read more >
Handling JSON null and empty arrays and objects
JSON has a special value called null which can be set on any type of data including arrays, objects, number and boolean types....
Read more >
Using Optional and Nullable Properties in API Requests
Learn how optional and nullable properties can be used flexibly in combinations in each parameter of your API requests made from a SDK....
Read more >
nullable vs type arrays (JSON Schema compatibility) #1389
I understand that fully supporting type arrays is a challenge for a variety of reasons. I would like to suggest that a compromise...
Read more >
C# 8.0 nullable references and serialization
C# 8's nullable references feature can clash with common serialization techniques. This article shows how to deal with that.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found