Add a toJSON primop
This commit is contained in:
parent
285df765b9
commit
77c13cdf56
10 changed files with 179 additions and 24 deletions
1
tests/lang/eval-okay-tojson.exp
Normal file
1
tests/lang/eval-okay-tojson.exp
Normal file
|
@ -0,0 +1 @@
|
|||
"{\"a\":123,\"b\":-456,\"c\":\"foo\",\"d\":\"foo\\n\\\"bar\\\"\",\"e\":true,\"f\":false,\"g\":[1,2,3],\"h\":[\"a\",[\"b\",{\"foo\\nbar\":{}}]],\"i\":3}"
|
11
tests/lang/eval-okay-tojson.nix
Normal file
11
tests/lang/eval-okay-tojson.nix
Normal file
|
@ -0,0 +1,11 @@
|
|||
builtins.toJSON
|
||||
{ a = 123;
|
||||
b = -456;
|
||||
c = "foo";
|
||||
d = "foo\n\"bar\"";
|
||||
e = true;
|
||||
f = false;
|
||||
g = [ 1 2 3 ];
|
||||
h = [ "a" [ "b" { "foo\nbar" = {}; } ] ];
|
||||
i = 1 + 2;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue