> This page location: JSON Functions > jsonb_typeof
> Full Neon documentation index: https://neon.com/docs/llms.txt

# PostgreSQL jsonb_typeof() Function

**Summary**: in this tutorial, you will learn how to use the PostgreSQL `jsonb_typeof()` function to return the type of the top-level JSON value as a text string.

## Introduction to the PostgreSQL jsonb_typeof() function

The `jsonb_typeof()` function allows you to get the type of a top-level JSONB value as a text string.

Here's the syntax of the `jsonb_typeof()` function:

```sql
jsonb_typeof(jsonb_value)
```

In this syntax:

- `jsonb_value` is a JSONB value of which you want to get the type as a text string.

The `jsonb_typeof()` function returns a text string representing the type of the input JSONB value. The possible return values are object, array, string, number, and null.

## PostgreSQL jsonb_typeof() function examples

Let's take some examples of using the `jsonb_typeof()` function.

The following example uses the `jsonb_typeof()` function to return the type of a JSON object:

```sql
SELECT jsonb_typeof('{}');
```

Output:

```text
 jsonb_typeof
--------------
 object
(1 row)
```

The following example uses the `jsonb_typeof()` function to return the type of a JSON array:

```sql
select jsonb_typeof('[]');
```

Output:

```text
 jsonb_typeof
--------------
 array
(1 row)
```

The following example uses the `jsonb_typeof()` function to return the type of a number:

```sql
SELECT jsonb_typeof('1'::jsonb);
```

Output:

```text
 jsonb_typeof
--------------
 number
(1 row)
```

The following example uses the `jsonb_typeof()` function to return the type of null:

```sql
SELECT jsonb_typeof('null'::jsonb);
```

Output:

```text
 jsonb_typeof
--------------
 null
(1 row)
```

The following example uses the `jsonb_typeof()` function to return the type of string:

```sql
SELECT
  jsonb_typeof(
    jsonb_path_query('{"name": "Alice"}', '$.name')
  );
```

Output:

```text
 jsonb_typeof
--------------
 string
(1 row)
```

## Summary

- Use the `jsonb_typeof()` function to return the type of the top-level JSON value as a text string.

---

## Related docs (JSON Functions)

- [Extracting JSON Data](https://neon.com/postgresql/postgresql-json-functions/postgresql-json-extract)
- [JSONB Operators](https://neon.com/postgresql/postgresql-json-functions/postgresql-jsonb-operators)
- [jsonb_agg](https://neon.com/postgresql/postgresql-json-functions/postgresql-jsonb_agg)
- [jsonb_array_elements](https://neon.com/postgresql/postgresql-json-functions/postgresql-jsonb_array_elements)
- [jsonb_array_elements_text](https://neon.com/postgresql/postgresql-json-functions/postgresql-jsonb_array_elements_text)
- [jsonb_array_length](https://neon.com/postgresql/postgresql-json-functions/postgresql-jsonb_array_length)
- [jsonb_build_array](https://neon.com/postgresql/postgresql-json-functions/postgresql-jsonb_build_array)
- [jsonb_build_object](https://neon.com/postgresql/postgresql-json-functions/postgresql-jsonb_build_object)
- [jsonb_each](https://neon.com/postgresql/postgresql-json-functions/postgresql-jsonb_each)
- [jsonb_each_text](https://neon.com/postgresql/postgresql-json-functions/postgresql-jsonb_each_text)
- [jsonb_extract_path](https://neon.com/postgresql/postgresql-json-functions/postgresql-jsonb_extract_path)
- [jsonb_extract_path_text](https://neon.com/postgresql/postgresql-json-functions/postgresql-jsonb_extract_path_text)
- [jsonb_insert](https://neon.com/postgresql/postgresql-json-functions/postgresql-jsonb_insert)
- [jsonb_object](https://neon.com/postgresql/postgresql-json-functions/postgresql-jsonb_object)
- [jsonb_object_agg](https://neon.com/postgresql/postgresql-json-functions/postgresql-jsonb_object_agg)
- [jsonb_object_keys](https://neon.com/postgresql/postgresql-json-functions/postgresql-jsonb_object_keys)
- [JSON Path](https://neon.com/postgresql/postgresql-json-functions/postgresql-json-path)
- [jsonb_path_exists](https://neon.com/postgresql/postgresql-json-functions/postgresql-jsonb_path_exists)
- [jsonb_path_query](https://neon.com/postgresql/postgresql-json-functions/postgresql-jsonb_path_query)
- [jsonb_path_query_array](https://neon.com/postgresql/postgresql-json-functions/postgresql-jsonb_path_query_array)
- [jsonb_path_query_first](https://neon.com/postgresql/postgresql-json-functions/postgresql-jsonb_path_query_first)
- [jsonb_pretty](https://neon.com/postgresql/postgresql-json-functions/postgresql-jsonb_pretty)
- [jsonb_set](https://neon.com/postgresql/postgresql-json-functions/postgresql-jsonb_set)
- [jsonb_strip_nulls](https://neon.com/postgresql/postgresql-json-functions/postgresql-jsonb_strip_nulls)
- [jsonb_to_record](https://neon.com/postgresql/postgresql-json-functions/postgresql-jsonb_to_record)
- [jsonb_populate_record](https://neon.com/postgresql/postgresql-json-functions/postgresql-jsonb_populate_record)
- [jsonb_populate_recordset](https://neon.com/postgresql/postgresql-json-functions/postgresql-jsonb_populate_recordset)
- [row_to_json](https://neon.com/postgresql/postgresql-json-functions/postgresql-row_to_json)
- [to_jsonb](https://neon.com/postgresql/postgresql-json-functions/postgresql-to_jsonb)
