Skip to content

Commit 3d7cf17

Browse files
authored
Update README.md
1 parent 6776400 commit 3d7cf17

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,28 @@ U.jsonToXml("{\"a\":{\"b\":\"data\"}}");
8686
// <a>
8787
// <b>data</b>
8888
// </a>
89+
90+
Map<String, Object> value = U.objectBuilder()
91+
.add("firstName", "John")
92+
.add("lastName", "Smith")
93+
.add("age", 25)
94+
.add("address", U.arrayBuilder()
95+
.add(U.objectBuilder()
96+
.add("streetAddress", "21 2nd Street")
97+
.add("city", "New York")
98+
.add("state", "NY")
99+
.add("postalCode", "10021")))
100+
.add("phoneNumber", U.arrayBuilder()
101+
.add(U.objectBuilder()
102+
.add("type", "home")
103+
.add("number", "212 555-1234"))
104+
.add(U.objectBuilder()
105+
.add("type", "fax")
106+
.add("number", "646 555-4567")))
107+
.build();
108+
// {firstName=John, lastName=Smith, age=25, address=[{streetAddress=21 2nd Street,
109+
// city=New York, state=NY, postalCode=10021}], phoneNumber=[{type=home, number=212 555-1234},
110+
// {type=fax, number=646 555-4567}]}
89111
```
90112

91113
In addition to porting Underscore's functionality, Underscore-java includes matching unit tests.

0 commit comments

Comments
 (0)