1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
{
"input": {
"Photos": [
{
"Id": "1234",
"Caption": "photo 1",
"Sizes": {
"thumbnail": {
"Url": "http://test.com/0001/1234/photoThumb.jpg",
"Id": "thumbnail"
},
"normal": {
"Url": "http://test.com/0001/1234/photo.jpg",
"Id": "normal"
}
},
"SizesOrder": [
"thumbnail",
"normal"
]
},
{
"Id": "5678",
"Caption": "photo 2",
"Sizes": {
"thumbnail": {
"Url": "http://test.com/0001/5678/photoThumb.jpg",
"Id": "thumbnail"
},
"normal": {
"Url": "http://test.com/0001/5678/photo.jpg",
"Id": "normal"
}
},
"SizesOrder": [
"thumbnail",
"normal"
]
}
]
},
// We aren't radically transforming the data here, just changing the case of the keys.
// This illustrates the usage of the '[]' and '&' operators, to put all the content in the right place, aka maintain order
"spec": {
"Photos": {
"*": {
"Id": "photos[&(1)].id",
"Caption": "photos[&(1)].caption",
"Sizes": {
"*": {
"Url": "photos[&(3)].sizes.&(1)"
}
},
"SizesOrder": "photos[&(1)].sizesOrder"
}
}
},
"expected": {
"photos": [
{
"id": "1234",
"caption": "photo 1",
"sizes": {
"thumbnail": "http://test.com/0001/1234/photoThumb.jpg",
"normal": "http://test.com/0001/1234/photo.jpg"
},
"sizesOrder": [
"thumbnail",
"normal"
]
},
{
"id": "5678",
"caption": "photo 2",
"sizes": {
"thumbnail": "http://test.com/0001/5678/photoThumb.jpg",
"normal": "http://test.com/0001/5678/photo.jpg"
},
"sizesOrder": [
"thumbnail",
"normal"
]
}
]
}
}