I did this small test and I don't see any problems or incompatibility. Can
someone show me where the use of the "%" can fail? Can someone show me an
example where the "%" is used in JSON as in tables "%{}"?
import tables
from strutils import `%`
import json
proc `%`[T,G,H](a : array[T,(G,H)]) : Table[G,H] =
a.toTable()
# Table
var h = %{"key_1": "value_1", "key_2": "value_2"}
echo h
echo h["key_1"]
# JSON
var j = %*{"key_1": "value_1", "key_2": "value_2"}
echo j
echo j["key_1"]
Run
Result:
$ nim c -r test.nim
Hint: operation successful (34378 lines compiled; 8.349 sec total;
46.828MiB peakmem; Debug Build) [SuccessX]
Hint: /home/hdias/Downloads/test [Exec]
{"key_1": "value_1", "key_2": "value_2"}
value_1
{"key_1": "value_1", "key_2": "value_2"}
"value_1"
Run