Skip to content

Commit 2403ab3

Browse files
Update README with new object syntax examples
1 parent 224de06 commit 2403ab3

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

README.md

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -935,45 +935,45 @@ Task: Return only users with role "user" as TOON. Use the same header. Set [N] t
935935

936936
## Quick Reference
937937

938-
```java
938+
```
939939
// Object
940-
Map.of("id", 1, "name", "Ada") → id: 1
941-
name: Ada
940+
{ id: 1, name: 'Ada' } → id: 1
941+
name: Ada
942942
943943
// Nested object
944-
Map.of("user", Map.of("id", 1)) → user:
945-
id: 1
944+
{ user: { id: 1 } } → user:
945+
id: 1
946946
947947
// Primitive array (inline)
948-
Map.of("tags", List.of("foo", "bar")) → tags[2]: foo,bar
948+
{ tags: ['foo', 'bar'] } → tags[2]: foo,bar
949949
950950
// Tabular array (uniform objects)
951-
Map.of("items", List.of( → items[2]{id,qty}:
952-
Map.of("id", 1, "qty", 5), 1,5
953-
Map.of("id", 2, "qty", 3) 2,3
954-
))
951+
{ items: [ → items[2]{id,qty}:
952+
{ id: 1, qty: 5 }, 1,5
953+
{ id: 2, qty: 3 } 2,3
954+
]}
955955
956956
// Mixed / non-uniform (list)
957-
Map.of("items", → items[3]:
958-
List.of(1, Map.of("a", 1), "x")) - 1
959-
- a: 1
960-
- x
957+
{ items: [1, { a: 1 }, 'x'] } → items[3]:
958+
- 1
959+
- a: 1
960+
- x
961961
962962
// Array of arrays
963-
Map.of("pairs", → pairs[2]:
964-
List.of(List.of(1, 2), List.of(3, 4))) - [2]: 1,2
965-
- [2]: 3,4
963+
{ pairs: [[1, 2], [3, 4]] } → pairs[2]:
964+
- [2]: 1,2
965+
- [2]: 3,4
966966
967967
// Root array
968-
List.of("x", "y") → [2]: x,y
968+
['x', 'y'] → [2]: x,y
969969
970970
// Empty containers
971-
Map.of() → (empty output)
972-
Map.of("items", List.of()) → items[0]:
971+
{} → (empty output)
972+
{ items: [] } → items[0]:
973973
974974
// Special quoting
975-
Map.of("note", "hello, world") → note: "hello, world"
976-
Map.of("items", List.of("true", true)) → items[2]: "true",true
975+
{ note: 'hello, world' } → note: "hello, world"
976+
{ items: ['true', true] } → items[2]: "true",true
977977
```
978978

979979
## Implementations in Other Languages

0 commit comments

Comments
 (0)