Entity Framework for querying JSON strings in SQL Server Entity Framework for querying JSON strings in SQL Server json json

Entity Framework for querying JSON strings in SQL Server


As of SQL Server 2016, FOR JSON and OPENJSON exist, equivalent to FOR XML and OPENXML. You can Index on expressions that reference JSON stored in NVARCHAR columns.


This is a very late answer, but for anyone who is still searching...

As @Emyr says, SQL 2016 supports querying inside JSON columns using JSON_VALUE or OPENJSON statements.

Entity Framework still does not support this directly, but you can use the SqlQuery method to run a raw SQL command directly against the database which can query inside JSON columns and saves querying and deserializing every row in order to run a simple query.


What you could do is create a CLR SQL Server User-Defined Function then use it from your query.

See this link https://msdn.microsoft.com/en-us/library/ms131077.aspx

i would think that a table-valued functions is more suited for your situation.