Commit Graph

43 Commits

Author SHA1 Message Date
jangko 34dc825066
Add copyright year to source file 2023-12-25 22:55:07 +07:00
zah f42567c00c
Basic support for Json flavours without default object serialization (#66)
Other changes:

* Migrate many procs accepting JsonReader to JsonLexer in order to
  reduce the number of generic instantiations and the resulting code
  bloat
2023-12-19 12:00:24 +02:00
Etan Kissling 85b7ea093c
add `{.raises.}` annotation to `writeValue` (#64)
Tag `writeValue` overrides with `{.raises: [IOError].}`.

The override in `writer.nim` also needs `gcsafe` to support recursion
in Nim 2.0.
2023-08-19 13:47:32 +02:00
Etan Kissling ed4440d881
use string value when encoding enums (#55)
Currently, we encode enum values always as the numeric value `ord(val)`.
unless explicitly overridden using `serializesAsTextInJson` or with a
custom `writeValue` implementation. Reduce verbosity by automatically
doing that.
2023-05-27 12:42:08 +03:00
Tanguy e5b18fb710
bugfix: a leading field with a 'none' value was producing an incorrect encoding (#50)
The field was omitted, but not the comma following it, resulting in an
encoding such as '{, otherFields: ...}'
2022-07-15 10:23:35 +00:00
tersec 5a7f9a86cb
fix Nim 1.6 deprecation warning (#48) 2022-07-01 17:48:29 +00:00
Zahary Karadjov bedbe6595a
Avoid overloading the separate classes of writeField ops 2022-06-19 12:38:44 +03:00
Zahary Karadjov 95399caff3
Use latest nim-serialization; Add tests for useCustomSerialization 2022-06-18 13:34:04 +03:00
Zahary Karadjov cc5038e0e2
Add writer.stepwiseArrayCreation 2022-06-17 20:16:28 +03:00
zah b9af0be99d
Don't write empty optional fields (#47) 2022-06-16 17:14:00 +03:00
tersec 7d3d339e73
rm TaintedString (#43) 2022-06-04 08:58:13 +02:00
Jacek Sieka cd044da00f
clean up imports/exports (#31) 2022-02-18 10:26:15 +01:00
Tanguy 010aa238cf Enable styleCheck:usages 2021-12-15 13:17:38 +02:00
Zahary Karadjov 297496d703 NULL cstrings are encoded to JS null 2021-11-01 18:59:12 +02:00
Zahary Karadjov fe8a82ca76
Adapt to the latest nim-serialization API 2021-03-19 04:13:55 +02:00
Zahary Karadjov 706eb5740e
Add support for serialization flavors 2021-03-18 13:01:06 +02:00
Zahary Karadjov cedf0c5f0c
Add a low-level API for controlling the state of the Writer when writing to the output stream manually 2020-11-27 19:42:33 +02:00
Zahary Karadjov 32f75d93b0
Add support for TaintedString 2020-11-12 21:00:10 +02:00
Zahary Karadjov f011bea54b
Add a helper for specifying enums types that must be serialized as strings 2020-08-02 20:15:13 +03:00
Zahary Karadjov d5eb9427b8
Serialization of JsonNode fields 2020-07-24 23:16:35 +03:00
Zahary Karadjov 4f2aa8b5cb
Make the JsonString type more accessible 2020-06-01 21:15:33 +03:00
Zahary Karadjov 2f5e71b25f
Use the latest FastStreams API 2020-05-13 11:43:52 +03:00
Jacek Sieka e485b74a10 treat array-of-char as string 2020-04-29 19:37:34 +03:00
Zahary Karadjov 16931f4fa3
Use the improved InputStream API 2020-04-10 16:46:12 +03:00
Zahary Karadjov bdddff5037
Use the latest FastStreams API 2020-04-09 23:14:14 +03:00
Zahary Karadjov 6350b72b5e
Handle openArrays in writeField 2020-03-18 20:20:35 +02:00
Zahary Karadjov ab53e009b9
Add JsonString. to facilitate easier logging in Chronicles 2020-03-18 18:21:18 +02:00
Zahary Karadjov 88b79e2300
Remove warnings in Nim 1.0.2 2019-11-04 18:42:34 +00:00
Zahary Karadjov f6a7da52e0
Handle the writing aspects of custom field serialization 2019-08-07 01:20:27 +03:00
Zahary Karadjov 9a8d593598
Fix compilation issues with Nim 0.19.6 2019-08-02 15:07:06 +03:00
Zahary Karadjov 943501f941
Improved support for range types 2019-07-19 02:02:15 +03:00
Zahary Karadjov 73d9e0d458
Handle changes in the serialization APIs 2019-07-18 21:20:17 +03:00
Zahary Karadjov 7922a83c4d
Serialization for sets 2019-07-16 13:20:05 +03:00
Zahary Karadjov cbec44d339 Handle more standard-libary types 2019-03-25 01:11:54 +02:00
Zahary Karadjov c2daa5a23c Improved error handling and pretty-printing for arrays 2019-03-20 01:54:16 +02:00
Ștefan Talpalaru 002c6bbb38
assert() -> doAssert()
and an explicit "test" task for the sake of nimble.sh
2019-03-14 00:39:10 +01:00
Zahary Karadjov a9d565f8e0 Tests with distinct types 2019-03-13 23:20:58 +02:00
Zahary Karadjov 49c07ca512 Handle the latest OutputStream changes 2019-03-11 11:39:19 +02:00
Zahary Karadjov daa60be371 Handle objects without fields gracefully 2018-12-28 03:02:20 +02:00
Zahary Karadjov 6d3fae7df2 Json deserialisation; Tests 2018-12-19 12:47:53 +02:00
Zahary Karadjov 53f5c427e0 fix a serialization issue affecting the ETH-P2P tracing 2018-11-29 03:38:35 +02:00
Zahary Karadjov e5da7654d5 Use the proper field enumeration logic; Add some high-level helpers and tests 2018-11-11 13:46:19 +02:00
Zahary Karadjov 4728844a32 Initial JSON serializer 2018-11-10 02:16:09 +02:00