We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 21c5cad commit 0941112Copy full SHA for 0941112
vlib/json/cjson/cjson_test.v
@@ -6,3 +6,16 @@ fn test_object_with_null() {
6
root.add_item_to_object('age', cjson.create_null())
7
assert root.print_unformatted() == '{"name":"Andre","age":null}'
8
}
9
+
10
+fn test_creating_complex_json() {
11
+ mut root := cjson.create_array()
12
+ root.add_item_to_array(cjson.create_string('user'))
13
+ mut obj := cjson.create_object()
14
+ obj.add_item_to_object('username', cjson.create_string('foo'))
15
+ obj.add_item_to_object('password', cjson.create_string('bar'))
16
+ root.add_item_to_array(obj)
17
+ result := root.print_unformatted()
18
+ println(result)
19
20
+ assert result == '["user",{"username":"foo","password":"bar"}]'
21
+}
0 commit comments