1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

json.cjson: add a submodule that allows lower level access to the cJSON library (constructing JSON trees in memory with null leafs).

This commit is contained in:
Delyan Angelov
2022-07-20 22:55:26 +03:00
parent c8d4534f5b
commit 8593408179
3 changed files with 195 additions and 1 deletions

View File

@ -0,0 +1,8 @@
import json.cjson
fn test_object_with_null() {
mut root := cjson.create_object()
root.add_item_to_object('name', cjson.create_string('Andre'))
root.add_item_to_object('age', cjson.create_null())
assert root.print_unformatted() == '{"name":"Andre","age":null}'
}