Skip to content

Commit

Permalink
Added documentation for the json_size function
Browse files Browse the repository at this point in the history
  • Loading branch information
nezihyigitbasi authored and dain committed Jun 30, 2014
1 parent 0171c54 commit 1e12b6e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions presto-docs/src/main/sphinx/functions/json.rst
Expand Up @@ -53,3 +53,13 @@ JSON Functions
SELECT json_array_get('[]', 0); => null
SELECT json_array_get('["a", "b", "c"]', 10); => null
SELECT json_array_get('["c", "b", "a"]', -10); => null

.. function:: json_size(json, json_path) -> bigint

Like :func:`json_extract`, but returns the size of the value. The size of
an object value is the number of fields and the size of an array is the
number of elements. The size of a scalar value is zero. For example: ::

SELECT json_size('{ "x": {"a": 1, "b": 2} }', '$.x'); => 2
SELECT json_size('{ "x": [1, 2, 3] }', '$.x'); => 2
SELECT json_size('{ "x": {"a": 1, "b": 2} }', '$.x.a'); => 0

0 comments on commit 1e12b6e

Please sign in to comment.