tjsonmacro_reject.nim 328 B

12345678910111213141516171819
  1. discard """
  2. errormsg: "Use a named tuple instead of: (string, float)"
  3. file: "tjsonmacro_reject.nim"
  4. line: 11
  5. """
  6. import json
  7. type
  8. Car = object
  9. engine: (string, float)
  10. model: string
  11. let j = """
  12. {"engine": {"name": "V8", "capacity": 5.5}, model: "Skyline"}
  13. """
  14. let parsed = parseJson(j)
  15. echo(to(parsed, Car))