
Jsonb_extract_path_text("Extent1"."JObject", 'a') AS "C4", Jsonb_typeof(jsonb_extract_path("Extent1"."JObject", 'a')) AS "C2", Jsonb_typeof("Extent1"."JObject") AS "C1", The following SQL query will be generated for this LINQ query: SELECT GetObjectFieldAsText = PgSqlJsonbFunctions.GetObjectFieldAsText(t.JObject, "a") GetObjectField = PgSqlJsonbFunctions.GetObjectField(t.JObject, "a"), ObjectType = PgSqlJsonbFunctions.TypeOf(t.JObject),įieldType = PgSqlJsonbFunctions.TypeOf(PgSqlJsonbFunctions.ExtractPath(t.JObject, "a")),ĮxtractPath = PgSqlJsonbFunctions.ExtractPath(t.JObject, "a"),ĮxtractPathText = PgSqlJsonbFunctions.ExtractPathText(t.JObject, "a"), Where(t => PgSqlJsonbFunctions.GetObjectFieldAsText(t.JObject, "a") = "foo") The following query demonstrates using various PostgreSQL specific JSON-related functions and operators. Returns the specified JSON object as indented JSON text. JSONB_EXTRACT_PATH_TEXT: equivalent to the #> operator JSONB_EXTRACT_PATH: equivalent to the #> operator For any scalar type other than a number, a Boolean, or a null value, the text representation is used. Otherwise, if there is a cast from the type to jsonb, this cast function will be used to perform the conversion otherwise, returns a valid scalar jsonb value. It converts arrays and composite objects to JSON arrays and objects. It has the following methods: PgSqlJsonbFunctions methods The PgSqlJsonbFunctions class is intended for working with jsonb PostgreSQL data type.

Returns the specified JSON object with all fields that have null values omitted. Returns an array element as text by a zero-based index. Returns an array element by a zero-based index. Returns an onject field value as text by its key. Returns an onject field value by its key. Returns a JSON object at the specified path as text. JSON_EXTRACT_PATH_TEXT: equivalent to the #> operator Returns a JSON object at the specified path. JSON_EXTRACT_PATH: equivalent to the #> operator Possible return values are: object, array, string, number, boolean, and null. Returns the type of the outermost JSON value as a string. Returns the number of elements in the outermost JSON array. In the latter case inner arrays are taken as key/value pairs. Array must either have one dimension and even number of elements, in this case these elements are taken as key/value pairs, or two dimensions, with each inner array having two elements. For any scalar type other than a number, a Boolean, or a null value, the text representation is used.Ĭreates a JSON object from a text array. Otherwise, if there is a cast from the type to json, this cast function will be used to perform the conversion otherwise, returns a valid scalar json value.


It has the following methods:Ĭorresponding PostgreSQL Functions and Operators The PgSqlJsonFunctions class is intended for working with json PostgreSQL data type.
#Postgres json query example code
This code will create the following table (for PostgreSQL 9.4 and higher): CREATE TABLE "JsonTable" (ĬONSTRAINT "PK_JsonTable" PRIMARY KEY ("Id")
