mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-29 17:34:43 +00:00
14 lines
390 B
Nim
14 lines
390 B
Nim
|
|
import json, tables, sequtils
|
|
|
|
proc run(json_params: TTable) =
|
|
let json_elems = json_params["files"].elems
|
|
# These fail compilation.
|
|
var files = map(json_elems, proc (x: PJsonNode): string = x.str)
|
|
#var files = json_elems.map do (x: PJsonNode) -> string: x.str
|
|
echo "Hey!"
|
|
|
|
when isMainModule:
|
|
let text = """{"files": ["a", "b", "c"]}"""
|
|
run(toTable((text.parseJson).fields))
|