Select your cookie preferences

We use essential cookies and similar tools that are necessary to provide our site and services. We use performance cookies to collect anonymous statistics, so we can understand how customers use our site and make improvements. Essential cookies cannot be deactivated, but you can choose “Customize” or “Decline” to decline performance cookies.

If you agree, AWS and approved third parties will also use cookies to provide useful site features, remember your preferences, and display relevant content, including relevant advertising. To accept or decline all non-essential cookies, choose “Accept” or “Decline.” To make more detailed choices, choose “Customize.”

JSON.TYPE

Focus mode
JSON.TYPE - Amazon MemoryDB

Report type of the values at the given path.

Syntax

JSON.TYPE <key> [path]
  • key (required) – key of JSON document type

  • path (optional) – a JSON path. Defaults to the root if not provided

Return

If the path is enhanced syntax:

  • Array of strings, representing type of the value at each path. The type is one of {"null", "boolean", "string", "number", "integer", "object" and "array"}.

  • If a path does not exist, its corresponding return value is null.

  • Empty array if the document key does not exist.

If the path is restricted syntax:

  • String, type of the value

  • Null if the document key does not exist.

  • Null if the JSON path is invalid or does not exist.

Examples

Enhanced path syntax:

127.0.0.1:6379> JSON.SET k1 . '[1, 2.3, "foo", true, null, {}, []]' OK 127.0.0.1:6379> JSON.TYPE k1 $[*] 1) integer 2) number 3) string 4) boolean 5) null 6) object 7) array

Restricted path syntax:

127.0.0.1:6379> JSON.SET k1 . '{"firstName":"John","lastName":"Smith","age":27,"weight":135.25,"isAlive":true,"address":{"street":"21 2nd Street","city":"New York","state":"NY","zipcode":"10021-3100"},"phoneNumbers":[{"type":"home","number":"212 555-1234"},{"type":"office","number":"646 555-4567"}],"children":[],"spouse":null}' OK 127.0.0.1:6379> JSON.TYPE k1 object 127.0.0.1:6379> JSON.TYPE k1 .children array 127.0.0.1:6379> JSON.TYPE k1 .firstName string 127.0.0.1:6379> JSON.TYPE k1 .age integer 127.0.0.1:6379> JSON.TYPE k1 .weight number 127.0.0.1:6379> JSON.TYPE k1 .isAlive boolean 127.0.0.1:6379> JSON.TYPE k1 .spouse null
PrivacySite termsCookie preferences
© 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved.