when (NimMajor, NimMinor) < (1, 4): {.push raises: [Defect].} else: {.push raises: [].} import json import ../../../waku/v2/protocol/waku_message, ./hexstrings export hexstrings ## Json marshalling proc `%`*(value: WakuMessage): JsonNode = ## This ensures that seq[byte] fields are marshalled to hex-format JStrings ## (as defined in `hexstrings.nim`) rather than the default JArray[JInt] let jObj = newJObject() for k, v in value.fieldPairs: jObj[k] = %v return jObj