JSON.CLEAR - Amazon ElastiCache for Redis
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China.


Clears the arrays or an object at the path.


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

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


  • Integer, the number of containers cleared.

  • Clearing an empty array or object accounts for 1 container cleared.

  • Clearing a non-container value returns 0.

Examples> JSON.SET k1 . '[[], [0], [0,1], [0,1,2], 1, true, null, "d"]' OK> JSON.CLEAR k1 $[*] (integer) 7> JSON.CLEAR k1 $[*] (integer) 4> JSON.SET k2 . '{"children": ["John", "Jack", "Tom", "Bob", "Mike"]}' OK> JSON.CLEAR k2 .children (integer) 1> JSON.GET k2 .children "[]"