tjsonmacro_reject2.nim 362 B

12345678910111213141516171819202122
  1. discard """
  2. errormsg: "The `to` macro does not support ref objects with cycles."
  3. file: "tjsonmacro_reject2.nim"
  4. line: 10
  5. """
  6. import json
  7. type
  8. Misdirection = object
  9. cycle: Cycle
  10. Cycle = ref object
  11. foo: string
  12. cycle: Misdirection
  13. let data = """
  14. {"cycle": null}
  15. """
  16. let dataParsed = parseJson(data)
  17. let dataDeser = to(dataParsed, Cycle)