Skip to content

Latest commit

 

History

History
58 lines (40 loc) · 1.37 KB

stringtoobject.md

File metadata and controls

58 lines (40 loc) · 1.37 KB
title titleSuffix description author ms.author ms.reviewer ms.service ms.subservice ms.topic ms.devlang ms.date ms.custom
StringToObject
Azure Cosmos DB for NoSQL
An Azure Cosmos DB for NoSQL system function that returns a string expression converted to an object.
jcodella
jacodel
sidandrews
cosmos-db
nosql
reference
nosql
02/27/2024
query-reference

StringToObject (NoSQL query)

[!INCLUDENoSQL]

Converts a string expression to an object.

Syntax

StringToObject(<string_expr>)  

Arguments

Description
string_expr A string expression.

Return types

Returns an object.

Examples

The following example illustrates how this function works with various inputs.

:::code language="nosql" source="~/cosmos-db-nosql-query-samples/scripts/stringtoobject/query.sql" highlight="2-7":::

:::code language="json" source="~/cosmos-db-nosql-query-samples/scripts/stringtoobject/result.json":::

Remarks

  • This function doesn't use the index.
  • If the expression can't be converted, the function returns undefined.
  • Nested string values must be written with double quotes to be valid.

Note

For more information on the JSON format, see https://json.org.

Related content