From 6d1de535d8ee993a7d5a09b597b5e08e6d04e4fd Mon Sep 17 00:00:00 2001 From: Eric <5089238+emizzle@users.noreply.github.com> Date: Fri, 9 Feb 2024 10:54:07 +1100 Subject: [PATCH] Change parseJson to JsonNode.parse Exporting `parseJson` causes symbol clashes in downstream repos that import std/json, so changing the signature completely avoid this clash. --- serde/json/parser.nim | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/serde/json/parser.nim b/serde/json/parser.nim index caa855c..ee09c23 100644 --- a/serde/json/parser.nim +++ b/serde/json/parser.nim @@ -6,8 +6,9 @@ import ./types {.push raises: [].} -proc parseJson*(json: string): ?!JsonNode = - ## fix for nim raising Exception +proc parse*(_: type JsonNode, json: string): ?!JsonNode = + # Used as a replacement for `std/json.parseJson`. Will not raise Exception like in the + # standard library try: return stdjson.parseJson(json).catch except Exception as e: