@@ -23,7 +23,9 @@ Motivation
23
23
24
24
A useful feature that is common in other expression languages is the
25
25
ability to sort a JSON object based on a particular key. For example,
26
- given a JSON object::
26
+ given a JSON object:
27
+
28
+ .. code :: json
27
29
28
30
{
29
31
"people" : [
@@ -46,7 +48,9 @@ would be evaluated against. In the simplest case, this expression would just
46
48
be an ``identifier ``, but more complex expressions could be used such as
47
49
``foo.bar.baz ``.
48
50
49
- A simple way to accomplish this might be to create a function like this::
51
+ A simple way to accomplish this might be to create a function like this:
52
+
53
+ .. code :: python
50
54
51
55
sort_by(array arg1, expression)
52
56
@@ -56,7 +60,9 @@ A simple way to accomplish this might be to create a function like this::
56
60
sort_by(people, to_number(age_str))
57
61
58
62
However, there's a problem with the ``sort_by `` function as defined above.
59
- If we follow the function argument resolution process we get::
63
+ If we follow the function argument resolution process we get:
64
+
65
+ .. code :: python
60
66
61
67
sort_by(people, age)
62
68
@@ -107,7 +113,9 @@ expression. Similarly how arrays can specify a type within a list using the
107
113
``expression->type `` syntax.
108
114
109
115
Note that any valid expression is allowed after ``& ``, so the following
110
- expressions are valid::
116
+ expressions are valid:
117
+
118
+ .. code :: python
111
119
112
120
sort_by(people, & foo.bar.baz)
113
121
sort_by(people, & foo.bar[0 ].baz)
0 commit comments