Skip to content

Instantly share code, notes, and snippets.

@Yardanico
Created August 1, 2020 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Yardanico/7d46844e887ae0f166a61a6cd585866d to your computer and use it in GitHub Desktop.
Save Yardanico/7d46844e887ae0f166a61a6cd585866d to your computer and use it in GitHub Desktop.
import json
type
KeyValue = tuple[key: string; val: string]
proc tt(x: KeyValue) =
var it = x
let a = (it.key, it.val)
echo a
proc encodedQuery(node: JsonNode): string =
var query: seq[KeyValue]
for q in node.pairs:
query.add (key: "hello", val: $q.val)
for elem in query:
elem.tt()
proc main =
var cq = newJObject()
cq["a"] = newJInt(1)
cq["b"] = newJInt(2)
let enc = cq.encodedQuery()
echo enc
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment