--- &test-9U5K
Title: Spec Example 2.12. Compact Nested Mapping
Tags: [ mapping, sequence, spec ]
---
# Products purchased
- item : Super Hoop
quantity: 1
- item : Basketball
quantity: 4
- item : Big Shoes
quantity: 1
+STR
+DOC ---
+SEQ
+MAP
=VAL :item
=VAL :Super Hoop
=VAL :quantity
=VAL :1
-MAP
+MAP
=VAL :item
=VAL :Basketball
=VAL :quantity
=VAL :4
-MAP
+MAP
=VAL :item
=VAL :Big Shoes
=VAL :quantity
=VAL :1
-MAP
-SEQ
-DOC
-STR
[
{
"item": "Super Hoop",
"quantity": 1
},
{
"item": "Basketball",
"quantity": 4
},
{
"item": "Big Shoes",
"quantity": 1
}
]
json_diff
[
{
"item": "Super Hoop",
"quantity": "1"
},
{
"item": "Basketball",
"quantity": "4"
},
{
"item": "Big Shoes",
"quantity": "1"
}
]
json_diff
[
{
"item": "Super Hoop",
"quantity": "1"
},
{
"item": "Basketball",
"quantity": "4"
},
{
"item": "Big Shoes",
"quantity": "1"
}
]
na
Line Col Char Byte Token|Content
1 0 0 0 +DOC |
1 0 0 0 =HEAD|---
1 3 3 3 +NODE|
1 3 3 3 =EOL |\x0a
2 0 4 4 +COMM|
2 0 4 4 =SYNX|#
2 1 5 5 =META|.Products.purchased
2 20 24 24 -COMM|
2 20 24 24 =EOL |\x0a
3 0 25 25 +SEQ |
3 0 25 25 =SYNX|-
3 1 26 26 =DENT|.
3 2 27 27 +NODE|
3 2 27 27 +MAP |
3 2 27 27 +PAIR|
3 2 27 27 +NODE|
3 2 27 27 +VAL |
3 2 27 27 =TEXT|item
3 6 31 31 -VAL |
3 6 31 31 -NODE|
3 6 31 31 =WSPC|....
3 10 35 35 =SYNX|:
3 11 36 36 =WSPC|.
3 12 37 37 +NODE|
3 12 37 37 +VAL |
3 12 37 37 =TEXT|Super.Hoop
3 22 47 47 -VAL |
3 22 47 47 -NODE|
3 22 47 47 =EOL |\x0a
4 0 48 48 -PAIR|
4 0 48 48 =DENT|..
4 2 50 50 +PAIR|
4 2 50 50 +NODE|
4 2 50 50 +VAL |
4 2 50 50 =TEXT|quantity
4 10 58 58 -VAL |
4 10 58 58 -NODE|
4 10 58 58 =SYNX|:
4 11 59 59 =WSPC|.
4 12 60 60 +NODE|
4 12 60 60 +VAL |
4 12 60 60 =TEXT|1
4 13 61 61 -VAL |
4 13 61 61 -NODE|
4 13 61 61 =EOL |\x0a
5 0 62 62 -PAIR|
5 0 62 62 -MAP |
5 0 62 62 -NODE|
5 0 62 62 =SYNX|-
5 1 63 63 =DENT|.
5 2 64 64 +NODE|
5 2 64 64 +MAP |
5 2 64 64 +PAIR|
5 2 64 64 +NODE|
5 2 64 64 +VAL |
5 2 64 64 =TEXT|item
5 6 68 68 -VAL |
5 6 68 68 -NODE|
5 6 68 68 =WSPC|....
5 10 72 72 =SYNX|:
5 11 73 73 =WSPC|.
5 12 74 74 +NODE|
5 12 74 74 +VAL |
5 12 74 74 =TEXT|Basketball
5 22 84 84 -VAL |
5 22 84 84 -NODE|
5 22 84 84 =EOL |\x0a
6 0 85 85 -PAIR|
6 0 85 85 =DENT|..
6 2 87 87 +PAIR|
6 2 87 87 +NODE|
6 2 87 87 +VAL |
6 2 87 87 =TEXT|quantity
6 10 95 95 -VAL |
6 10 95 95 -NODE|
6 10 95 95 =SYNX|:
6 11 96 96 =WSPC|.
6 12 97 97 +NODE|
6 12 97 97 +VAL |
6 12 97 97 =TEXT|4
6 13 98 98 -VAL |
6 13 98 98 -NODE|
6 13 98 98 =EOL |\x0a
7 0 99 99 -PAIR|
7 0 99 99 -MAP |
7 0 99 99 -NODE|
7 0 99 99 =SYNX|-
7 1 100 100 =DENT|.
7 2 101 101 +NODE|
7 2 101 101 +MAP |
7 2 101 101 +PAIR|
7 2 101 101 +NODE|
7 2 101 101 +VAL |
7 2 101 101 =TEXT|item
7 6 105 105 -VAL |
7 6 105 105 -NODE|
7 6 105 105 =WSPC|....
7 10 109 109 =SYNX|:
7 11 110 110 =WSPC|.
7 12 111 111 +NODE|
7 12 111 111 +VAL |
7 12 111 111 =TEXT|Big.Shoes
7 21 120 120 -VAL |
7 21 120 120 -NODE|
7 21 120 120 =EOL |\x0a
8 0 121 121 -PAIR|
8 0 121 121 =DENT|..
8 2 123 123 +PAIR|
8 2 123 123 +NODE|
8 2 123 123 +VAL |
8 2 123 123 =TEXT|quantity
8 10 131 131 -VAL |
8 10 131 131 -NODE|
8 10 131 131 =SYNX|:
8 11 132 132 =WSPC|.
8 12 133 133 +NODE|
8 12 133 133 +VAL |
8 12 133 133 =TEXT|1
8 13 134 134 -VAL |
8 13 134 134 -NODE|
8 13 134 134 =EOL |\x0a
9 0 135 135 -PAIR|
9 0 135 135 -MAP |
9 0 135 135 -NODE|
9 0 135 135 -SEQ |
9 0 135 135 -NODE|
9 0 135 135 -DOC |
na
[
{
'item' => 'Super Hoop',
'quantity' => 1
},
{
'item' => 'Basketball',
'quantity' => 4
},
{
'item' => 'Big Shoes',
'quantity' => 1
}
]
na
[
{
'item' => 'Super Hoop',
'quantity' => 1
},
{
'item' => 'Basketball',
'quantity' => 4
},
{
'item' => 'Big Shoes',
'quantity' => 1
}
]
na
[
{
'item' => 'Super Hoop',
'quantity' => 1
},
{
'item' => 'Basketball',
'quantity' => 4
},
{
'item' => 'Big Shoes',
'quantity' => 1
}
]
na
[
{
'item' => 'Super Hoop',
'quantity' => '1'
},
{
'item' => 'Basketball',
'quantity' => '4'
},
{
'item' => 'Big Shoes',
'quantity' => '1'
}
]
na
[
{
'item' => 'Super Hoop',
'quantity' => 1
},
{
'item' => 'Basketball',
'quantity' => 4
},
{
'item' => 'Big Shoes',
'quantity' => 1
}
]
na
[
{
'item' => 'Super Hoop',
'quantity' => 1
},
{
'item' => 'Basketball',
'quantity' => 4
},
{
'item' => 'Big Shoes',
'quantity' => 1
}
]
na
[{'item': 'Super Hoop', 'quantity': 1},
{'item': 'Basketball', 'quantity': 4},
{'item': 'Big Shoes', 'quantity': 1}]
na
[{'item': 'Super Hoop', 'quantity': 1},
{'item': 'Basketball', 'quantity': 4},
{'item': 'Big Shoes', 'quantity': 1}]