Instead of using std/json in Nimony to build JSON strings from a DOM, let's use an approach similar to the one used by the httpheaders module, with compile-time validation of string literals.
JSON will be supplied as string literals, and when an expression involves string concatenation with runtime values, the compile-time plugin should be able to infer the necessary information and inject the appropriate runtime operations.
For example:
json"{'key':" & myArr & "}"
json"{'key': [1, 0, " & myInt & "]}"
json"{" & myKey & ":[1]}"