mirror of
https://github.com/logos-storage/nim-serde.git
synced 2026-01-03 22:23:11 +00:00
15 lines
305 B
Nim
15 lines
305 B
Nim
import std/json as stdjson
|
|
|
|
import pkg/questionable/results
|
|
|
|
import ./types
|
|
|
|
{.push raises: [].}
|
|
|
|
proc parseJson*(json: string): ?!JsonNode =
|
|
## fix for nim raising Exception
|
|
try:
|
|
return stdjson.parseJson(json).catch
|
|
except Exception as e:
|
|
return failure newException(JsonParseError, e.msg)
|