for i: v.entries.count {
if i > 0 do io.write_byte(w, #char ",");
- entry := v.entries[i];
+ entry := ^v.entries[i];
io.write_escaped_str(w, entry.key);
io.write_byte(w, #char ":");
return .None;
},
-
+ // This is disabled because I would prefer to have a compile time error for an unsupported type,
+ // as opposed to a error to check programatically.
+ //
// // Inserted after any of the #add_match directives
// #precedence 1000 (w: ^io.Writer, v: $T) -> Encoding_Error {
// return .Unsupported_Type;
use package core
json :: package json
-json_string := "{ \"test\": \"\\tHello,\\n\\\"World!\\\"\", \"array\": [1,2,3,4,5,1423], \"sub\": { \"mem\": true } }";
+json_string := "{ \"test\": \"\\tHello,\\n\\\"World!\\\"\", \"array\": [1,2,3,4,5,1423], \"sub\": { \"mem\": true, \"other\": null } }";
main :: (args: [] cstr) {
arena := alloc.arena.make(context.allocator, 4096);
// println(v["friends"][1]["name"]->as_str());
// }
- #if false {
+ #if true {
value := decoded_json.root["array"];
for v: value->as_array() {
println(v->as_int());