mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 17:04:41 +00:00
19 lines
328 B
Nim
19 lines
328 B
Nim
discard """
|
|
errormsg: "Use a named tuple instead of: (string, float)"
|
|
file: "tjsonmacro_reject.nim"
|
|
line: 11
|
|
"""
|
|
|
|
import json
|
|
|
|
type
|
|
Car = object
|
|
engine: (string, float)
|
|
model: string
|
|
|
|
let j = """
|
|
{"engine": {"name": "V8", "capacity": 5.5}, model: "Skyline"}
|
|
"""
|
|
let parsed = parseJson(j)
|
|
echo(to(parsed, Car))
|