summary refs log tree commit diff stats
path: root/lib/std/jsonutils.nim
Commit message (Collapse)AuthorAgeFilesLines
* Add better error messages to `std/jsonutils` (#20629)Jake Leahy2022-10-241-7/+7
| | | | | * Add better error messages * Add fmt on tuple msg
* Fix tuple size check in `std/jsonutils` (#20637)Jake Leahy2022-10-241-2/+12
| | | | | | | | | | | * Add test for tuple being invalid size * Test tuple size before accessing fields * Fix formatting for import * Fix not being able to build from csources_v1 Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* Pass json options to hooks (#20638)Jake Leahy2022-10-241-14/+16
| | | | | | | | | | | * Added tests * Fix expected string * Allow hooks to take an optional parameter that is the current options * Add options to hooks for other generic types * Fix doc links
* move assertions out of system (#19599)flywind2022-03-231-0/+3
|
* rename nimLegacyJsonutilsHoleyEnum [backport] (#18938)flywind2021-10-011-1/+5
| | | | | * enable nimPreviewJsonutilsHoleyEnum [backport] * docuement nimPreviewJsonutilsHoleyEnum
* Add optional recursive arg to distinctBase (v2) (#18659)Timothee Cour2021-08-091-2/+2
| | | | | | * Add optional recursive arg to distinctBase * Add docs and examples Co-authored-by: ALANVF <alan.invents@gmail.com>
* up to 20x faster jsonutils deserialization (#18183)Timothee Cour2021-06-051-6/+6
| | | | | * up to 20x faster jsonutils deserialization * noinline
* simplify extccomp.nim json logic via jsonutils; fix #18084 (#18100)Timothee Cour2021-06-031-1/+17
| | | | | | * simplify extccomp.nim json logic via jsonutils * fix #18084 * simplify further * workaround for bootstrap that can be removed after updating csources_v1 >= 1.2
* jsonutils.toJson now serializes JsonNode as is by default (#18097)Timothee Cour2021-05-311-4/+16
| | | | | * jsonutils.toJson now serializes JsonNode as is (without deep copy nor treating it as a regular ref object) * JsonNodeMode
* jsonutils: add customization for toJson via `ToJsonOptions`; generalize ↵Timothee Cour2021-05-181-11/+32
| | | | | | | | | | | | | | | | | | | symbolName; add symbolRank (#18029) * jsonutils: add customization for toJson via `ToJsonOptions` * add enumutils.symbolRank * lookup table implementation for HoleyEnum * cleanup * changelog * fixup * Update lib/std/jsonutils.nim Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* fix #18007: std/json now serializes nan,inf,-inf as strings instead of ↵Timothee Cour2021-05-161-0/+3
| | | | | | | | | | | | | | | | | invalid json (#18026) * fix #18007: std/json now serializes nan,inf,-inf as raw strings instead of invalid json * fix roundtrip * fix tests * fix changelog * simplify * add runnableExamples * fix typo [skip ci]
* jsonutils: handle holey enum as regular enum, via ord (#17995)Timothee Cour2021-05-111-0/+3
|
* jsonutils: support set (#17994)Timothee Cour2021-05-111-1/+5
|
* CIs: attempt to use csources_v1 (#16282)Andreas Rumpf2021-04-211-9/+9
| | | | | | | | * CIs: attempt to use csources_v1 * also updated the BSDs * also updated azure pipelines * std modules should not itself use the 'std/' import dir... * compiler has to be careful with std/ for v1 booting
* jsonutils: support cstring (including as Table key); improve docs (#16062)Timothee Cour2021-03-311-5/+17
| | | | | * jsonutils: support cstring (including as Table key); improve docs * changelog * un-disable a test now that #16061 was fixed
* fix #17383: json.%,to and jsonutils.formJson,toJson now works with ↵Timothee Cour2021-03-161-1/+3
| | | | | | | uint|uint64 (#17389) [backport:1.2] * fix #17383: json.%,to and jsonutils.formJson,toJson now works with uint|uint64 * fixup * fix for js
* Change stdlib imports to use std prefix in most examples (#17202)Danil Yarantsev2021-02-281-8/+8
|
* use typeof instead type (#16962)flywind2021-02-081-2/+2
|
* jsonutils.jsonTo: support opt (#16739)Timothee Cour2021-01-171-2/+2
|
* Jsonutils: pass opt for object in object (#16615)inv20042021-01-071-1/+1
| | | | | * jsonutils: fromJson forward opt param fix * jsonutils: object in object test + fix: opt pass
* jsonutils: fromJson forward opt param fix (#16612)inv20042021-01-061-4/+4
|
* Fix broken links in docs (#16336)Elliot Waite2020-12-141-4/+4
| | | | | * Fix broken links in docs * Fix rand HSlice links
* Correct all eggs (#15906)Miran2020-11-101-1/+1
| | | | * "eg" is a misspelled "egg", "e.g." is "exempli gratia" * Also, "ie" is "i.e.".
* Add some enhancements to `jsonutils.nim` (#15133)Ivan Bobev2020-09-091-31/+247
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add some enhancements to `jsonutils.nim` * Use `jsonutils.nim` hookable API to add a possibility to deserialize JSON arrays directly to `HashSet` and `OrderedSet` types and respectively to serialize those types to JSON arrays. * Also add a possibility to deserialize JSON `null` objects to Nim option objects and respectively to serialize Nim option object to JSON object if some or to JSON `null` object if none. * Move serialization/deserialization functionality for `Table` and `OrderedTable` types from `jsonutils.nim` to `tables.nim` via the hookable API. * Add object `jsonutils.Joptions` and parameter from its type to `jsonutils.fromJson` procedure to control whether to allow deserializing JSON objects to Nim objects when the JSON has some extra or missing keys. * Add unit tests for the added functionalities to `tjsonutils.nim`. * improve fromJsonFields * Add changelog entry for the jsonutils enhancements * Add TODO in `jsonutils.nim` * Added an entry to "Future directions" section in `jsonutils.nim` as suggestion for future support of serialization and de-serialization of nested variant objects. * Added currently disabled test case in `tjsonutils.nim` for testing serialization and de-serialization of nested variant objects. * Move JSON hooks to `jsonutils.nim` Move `fromJsonHook` and `toJsonHook` procedures for different types to `jsonutils.nim` module to avoid a dependency of collections modules to the `json.nim` module. The hooks are removed from the following modules: * `tables.nim` * `sets.nim` * `options.nim` * `strtabs.nim` * Add some tests about `StringTableRef` Add tests for `StringTableRef`'s `fromJsonHook` and `toJsonHook` to `tjsonutils.nim`. * Disable a warning in `jsonutils.nim` Mark `fun` template in `jsonutils` module with `{.used.}` pragma in order to disable `[XDeclaredButNotUsed]` hint. The template is actually used by the `initCaseObject` macro in the same module. Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
* fromJson: support object variants (#14694)Timothee Cour2020-06-241-15/+73
|
* make `fromJson/toJson` work with `array[range, typ]`, + 1 bugfix (#14669)Timothee Cour2020-06-151-8/+24
| | | | | * make toJson more robust * properly handle array
* `toJson`, `jsonTo`, json (de)serialization for custom types; remove ↵Timothee Cour2020-06-081-0/+126
dependency on strtabs thanks to a hooking mechanism (#14563) * json custom serialization; application for strtabs * serialize using nesting * make toJson more feature complete * add since * Revert "Improve JSON serialisation of strtabs (#14549)" This reverts commit 7cb4ef26addb3bb5ce2405d8396df6fd41664dae. * better approach via mixin * toJson, jsonTo * fix test * address comments * move to jsonutils * doc * cleanups * also test for js * also test for vm
Kartik K. Agaram <vc@akkartik.com> 2015-07-12 00:11:56 -0700 1766' href='/akkartik/mu/commit/html/071print.mu.html?h=main&id=d5d908dda655c791329563522faad42d7e4ee618'>d5d908dd ^
f5465e12 ^




672e3e50 ^
65361948 ^
f5465e12 ^


762b099e ^
f5465e12 ^


9570363a ^
f5465e12 ^



9570363a ^
f5465e12 ^
65361948 ^
f5465e12 ^



65361948 ^
f5465e12 ^
9570363a ^
f5465e12 ^
65361948 ^
f5465e12 ^




672e3e50 ^
9570363a ^

f5465e12 ^

65361948 ^
f5465e12 ^



65361948 ^
f5465e12 ^

65361948 ^
f5465e12 ^

9570363a ^
f5465e12 ^






9570363a ^
f5465e12 ^



672e3e50 ^
f5465e12 ^

9570363a ^
f5465e12 ^




672e3e50 ^
f5465e12 ^

65361948 ^
672e3e50 ^
f5465e12 ^
65361948 ^
f5465e12 ^



4bbd3ded ^

f5465e12 ^



4bbd3ded ^


f5465e12 ^
4bbd3ded ^
f5465e12 ^



65361948 ^

f5465e12 ^



65361948 ^

672e3e50 ^
f5465e12 ^
65361948 ^
f5465e12 ^





dbe12410 ^

f5465e12 ^




dbe12410 ^


f5465e12 ^
dbe12410 ^
f5465e12 ^






65361948 ^

f5465e12 ^




65361948 ^


f5465e12 ^
dbe12410 ^
f5465e12 ^






dbe12410 ^

f5465e12 ^






dbe12410 ^


f5465e12 ^
65361948 ^
f5465e12 ^






65361948 ^

f5465e12 ^





65361948 ^


f5465e12 ^
dbe12410 ^
f5465e12 ^





dbe12410 ^

f5465e12 ^

dbe12410 ^


f5465e12 ^
dbe12410 ^
f5465e12 ^










dbe12410 ^

f5465e12 ^











dbe12410 ^


f5465e12 ^


672e3e50 ^
f5465e12 ^




672e3e50 ^
f5465e12 ^

9570363a ^
f5465e12 ^



672e3e50 ^
f5465e12 ^


672e3e50 ^

f5465e12 ^
65361948 ^
672e3e50 ^
f5465e12 ^


672e3e50 ^
f5465e12 ^





9570363a ^
f5465e12 ^
65361948 ^
672e3e50 ^
f5465e12 ^




672e3e50 ^
f5465e12 ^







672e3e50 ^
f5465e12 ^

65361948 ^
672e3e50 ^
f5465e12 ^
65361948 ^
f5465e12 ^
672e3e50 ^
f5465e12 ^
672e3e50 ^
f5465e12 ^
672e3e50 ^
f5465e12 ^


65361948 ^
672e3e50 ^
65361948 ^
f5465e12 ^












65361948 ^

672e3e50 ^
f5465e12 ^


672e3e50 ^
f5465e12 ^


eaeb9552 ^
f5465e12 ^








672e3e50 ^

f5465e12 ^
65361948 ^
672e3e50 ^
f5465e12 ^


672e3e50 ^
f5465e12 ^


eaeb9552 ^
f5465e12 ^






672e3e50 ^

f5465e12 ^
65361948 ^
672e3e50 ^
f5465e12 ^


672e3e50 ^
f5465e12 ^


eaeb9552 ^
f5465e12 ^








672e3e50 ^

f5465e12 ^
65361948 ^
672e3e50 ^
f5465e12 ^


672e3e50 ^
f5465e12 ^


eaeb9552 ^
f5465e12 ^






672e3e50 ^

f5465e12 ^
65361948 ^

f5465e12 ^


9570363a ^
f5465e12 ^
9570363a ^
f5465e12 ^
65361948 ^

f5465e12 ^


9570363a ^

f5465e12 ^
65361948 ^

f5465e12 ^


e8b1d3ff ^
f5465e12 ^




e8b1d3ff ^

f5465e12 ^
e8b1d3ff ^

f5465e12 ^


e8b1d3ff ^
f5465e12 ^




e8b1d3ff ^

f5465e12 ^
e8b1d3ff ^

f5465e12 ^


62a52ffb ^
f5465e12 ^



62a52ffb ^

f5465e12 ^
62a52ffb ^

f5465e12 ^


62a52ffb ^
f5465e12 ^



62a52ffb ^

f5465e12 ^
62a52ffb ^

f5465e12 ^


62a52ffb ^
90560d71 ^
f5465e12 ^



62a52ffb ^

f5465e12 ^
62a52ffb ^

f5465e12 ^


62a52ffb ^
90560d71 ^
f5465e12 ^



62a52ffb ^

f5465e12 ^
62a52ffb ^

f5465e12 ^





e8b1d3ff ^
f5465e12 ^




d5d908dd ^
f5465e12 ^





9570363a ^
f5465e12 ^
9570363a ^
f5465e12 ^




65361948 ^

f5465e12 ^
dbe12410 ^
f5465e12 ^




dbe12410 ^

f5465e12 ^







dbe12410 ^


f5465e12 ^





e8b1d3ff ^
f5465e12 ^




d5d908dd ^
f5465e12 ^


65361948 ^
f5465e12 ^


65361948 ^
672e3e50 ^



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722