jsonExtract#

swordfish.function.jsonExtract()#

This function parses extracted JSON elements into specified data type.

Parameters:
  • json (Constant) – A LITERAL scalar or vector indicating the standard JSON string(s) to parse.

  • location (Constant) –

    A scalar/vector/tuple. Each element can be a string or a non-zero integer indicating the location at the corresponding dimension.

    • String: access element by key.

    • Positive integer: access the n-th element from the beginning.

    • Negative integer: access the n-th element from the end.

  • type (Constant) – A string specifying the data type of the return value. It can be “long”, “int”, “double”, or “string”.

Returns:

If json is a scalar, it returns a scalar; If json is a vector, it returns a vector.

If an element corresponding to location does not exist or cannot be parsed into expected data type, NULL is returned.

Return type:

Constant