You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/cosmos-db/sql-query-working-with-json.md
+8-6Lines changed: 8 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,13 +12,13 @@ ms.author: tisande
12
12
13
13
In Azure Cosmos DB's SQL (Core) API, items are stored as JSON. The type system and expressions are restricted to deal only with JSON types. For more information, see the [JSON specification](https://www.json.org/).
14
14
15
-
We'll summarize some important aspects of working with JSON.
15
+
We'll summarize some important aspects of working with JSON:
16
16
17
17
- JSON objects always begin with a `{` left brace and end with a `}` right brace
18
18
- You can have JSON properties [nested](#nested-properties) within one another
19
-
- JSON properties can have arrays values
20
-
- JSON properties are case sensitive
21
-
- JSON properties can have any string value (including spaces or characters that aren't letters)
19
+
- JSON property values can be arrays
20
+
- JSON property names are case sensitive
21
+
- JSON property name can be any string value (including spaces or characters that aren't letters)
22
22
23
23
## Nested properties
24
24
@@ -95,7 +95,7 @@ WHERE f.children[0].givenName = "Jesse"
95
95
96
96
In most cases, however, you'll use a [subquery](sql-query-subquery.md) or [self-join](sql-query-join.md) when working with arrays.
97
97
98
-
For example, here's a document that shows the bank account balance of a customer over each month during 2020.
98
+
For example, here's a document that shows the daily balance of a customer's bank account.
99
99
100
100
```json
101
101
{
@@ -122,7 +122,7 @@ For example, here's a document that shows the bank account balance of a customer
122
122
}
123
123
```
124
124
125
-
If you wanted to run a query that showed all the customers that had a negative balance at some point during 2020, it would use [EXISTS](sql-query-subquery.md#exists-expression) with a subquery:
125
+
If you wanted to run a query that showed all the customers that had a negative balance at some point, you could use [EXISTS](sql-query-subquery.md#exists-expression) with a subquery:
126
126
127
127
```sql
128
128
SELECTc.id
@@ -256,6 +256,8 @@ The results are:
256
256
}]
257
257
```
258
258
259
+
### Aliasing with reserved keywords or special characters
260
+
259
261
You can't use aliasing to project a value as a property name with a space, special character, or reserved word. If you wanted to change a value's projection to, for example, have a property name with a space, you could use a [JSON expression](#json-expressions).
0 commit comments