Class JsonFunctions

java.lang.Object
com.couchbase.client.java.query.dsl.functions.JsonFunctions

@Experimental
@Public
public class JsonFunctions
extends Object
DSL for N1QL functions in the JSON category.
Since:
2.2
Author:
Simon Baslé
  • Method Details

    • decodeJson

      public static Expression decodeJson​(Expression expression)
      The returned Expression unmarshals the expression representing a JSON-encoded string into a N1QL value. The empty string results in MISSING.
    • decodeJson

      public static Expression decodeJson​(JsonObject json)
      The returned Expression unmarshals the JSON constant into a N1QL value. The empty string results in MISSING.
    • decodeJson

      public static Expression decodeJson​(String jsonString)
      The returned Expression unmarshals the JSON-encoded string into a N1QL value. The empty string results in MISSING. The string must represent JSON object marshalled into a JSON String, eg. "{\"test\": true}" (excluding surrounding quotes).
    • encodeJson

      public static Expression encodeJson​(Expression expression)
      Returned expression marshals the N1QL value into a JSON-encoded string. MISSING becomes the empty string.
    • encodeJson

      public static Expression encodeJson​(String expression)
      Returned expression marshals the N1QL value into a JSON-encoded string. MISSING becomes the empty string.
    • encodedSize

      public static Expression encodedSize​(Expression expression)
      Returned expression results in the number of bytes in an uncompressed JSON encoding of the value. The exact size is implementation-dependent. Always returns an integer, and never MISSING or NULL. Returns 0 for MISSING.
    • encodedSize

      public static Expression encodedSize​(String expression)
      Returned expression results in the number of bytes in an uncompressed JSON encoding of the value. The exact size is implementation-dependent. Always returns an integer, and never MISSING or NULL. Returns 0 for MISSING.
    • polyLength

      public static Expression polyLength​(Expression expression)
      Returned expression results in length of the value after evaluating the expression. The exact meaning of length depends on the type of the value: - MISSING: MISSING - NULL: NULL - String: The length of the string. - Array: The number of elements in the array. - Object: The number of name/value pairs in the object - Any other value: NULL.
    • polyLength

      public static Expression polyLength​(String expression)
      Returned expression results in length of the value after evaluating the expression. The exact meaning of length depends on the type of the value: - MISSING: MISSING - NULL: NULL - String: The length of the string. - Array: The number of elements in the array. - Object: The number of name/value pairs in the object - Any other value: NULL.