-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathjson-review.html
15150 lines (13309 loc) · 574 KB
/
json-review.html
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
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en">
<head>
<!-- 2023-05-15 Mon 08:22 -->
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Review of CL JSON Libraries UPDATED 15 May 2023</title>
<meta name="author" content="Sabra Crolleton" />
<meta name="description" content="This is a tutorial chapter for the sc-webapp-tutorial" />
<meta name="keywords" content="common-lisp, postmodern, postgresql, webapp, easy-routes, djula, hunchentoot" />
<meta name="generator" content="Org Mode" />
<link rel="stylesheet" type="text/css" href="https://fniessen.github.io/org-html-themes/src/readtheorg_theme/css/htmlize.css"/>
<link rel="stylesheet" type="text/css" href="https://fniessen.github.io/org-html-themes/src/readtheorg_theme/css/readtheorg.css"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<script type="text/javascript" src="https://fniessen.github.io/org-html-themes/src/lib/js/jquery.stickytableheaders.min.js"></script>
<script type="text/javascript" src="https://fniessen.github.io/org-html-themes/src/readtheorg_theme/js/readtheorg.js"></script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
displayAlign: "center",
displayIndent: "0em",
"HTML-CSS": { scale: 100,
linebreaks: { automatic: "false" },
webFont: "TeX"
},
SVG: {scale: 100,
linebreaks: { automatic: "false" },
font: "TeX"},
NativeMML: {scale: 100},
TeX: { equationNumbers: {autoNumber: "AMS"},
MultLineWidth: "85%",
TagSide: "right",
TagIndent: ".8em"
}
});
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS_HTML"></script>
</head>
<body>
<div id="content" class="content">
<header>
<h1 class="title">Review of CL JSON Libraries UPDATED 15 May 2023</h1>
</header><nav id="table-of-contents" role="doc-toc">
<h2>Table of Contents</h2>
<div id="text-table-of-contents" role="doc-toc">
<ul>
<li><a href="#changelog">Changelog</a>
<ul>
<li><a href="#org16dc0f5">15 May 2023</a></li>
<li><a href="#org618b58a">12 Apr 2023</a></li>
<li><a href="#org04592be">1 Feb 2022</a></li>
<li><a href="#orgf90c510">19 Jan 2022</a></li>
<li><a href="#org2a05bb0">18 Jan 2022</a></li>
<li><a href="#org5277fba">15 Jan 2022</a></li>
</ul>
</li>
<li><a href="#introduction">Introduction</a>
<ul>
<li><a href="#libraries">Common Lisp Encoding and Decoding Libraries</a></li>
<li><a href="#helper-libraries-top">Helper Libraries</a></li>
</ul>
</li>
<li><a href="#quick-summary">Quick Summary</a></li>
<li><a href="#decoding">Decoding/Reading/Parsing JSON Data to Lisp</a>
<ul>
<li><a href="#decoding-streams-or-strings">Decoding Streams or Strings</a></li>
<li><a href="#mapping-json-cl">Mapping Data Types and Structures from JSON to CL</a>
<ul>
<li><a href="#decode-unicode">Unicode</a></li>
<li><a href="#number-mapping">Number Mapping</a></li>
<li><a href="#true-false-null-mapping">True, False, Null, Empty Array Mapping</a></li>
<li><a href="#decoding-arrays">Decoding JSON Arrays</a></li>
<li><a href="#decoding-objects">Decoding JSON Objects</a></li>
<li><a href="#decoding-nested-objects">Decoding Nested JSON Objects</a></li>
</ul>
</li>
<li><a href="#decode-to-clos">Converting JSON data to a CLOS object</a>
<ul>
<li><a href="#decode-to-clos-boost-json">Boost-json</a></li>
<li><a href="#decode-to-clos-cl-json">Cl-json</a></li>
<li><a href="#decode-to-clos-trivial-json-codec">Trivial-json-codec</a></li>
</ul>
</li>
<li><a href="#extracting-subset">Extracting a Subset of a JSON object</a></li>
<li><a href="#determining-object-keywords">Determining Object Keywords</a></li>
<li><a href="#decoding-nil">Handling NIL</a></li>
</ul>
</li>
<li><a href="#encoding">Encoding Lisp Data to JSON</a>
<ul>
<li><a href="#encoding-streams-or-strings">Encoding to Streams or Strings</a></li>
<li><a href="#encoding-symbols">Encoding Symbols, Chars, T, nil and :null</a></li>
<li><a href="#encoding-numbers">Encoding Numbers</a></li>
<li><a href="#encoding-pathnames">Encoding Pathnames</a></li>
<li><a href="#encoding-timestamps">Encoding Local-Time Timestamps</a></li>
<li><a href="#encoding-data-structures">Encoding Data Structures to JSON (Summary)</a></li>
<li><a href="#encoding-lists">Encoding Lists (Summary)</a></li>
<li><a href="#encoding-plain-lists">Encoding Plain Lists</a></li>
<li><a href="#encoding-alists">Encoding Alists</a></li>
<li><a href="#encoding-plists">Encoding Plists</a></li>
<li><a href="#encoding-arrays">Encoding Arrays</a>
<ul>
<li><a href="#encoding-vectors">Encoding Single Dimensional Vector</a></li>
<li><a href="#encoding-bit-vectors">Encoding Simple Bit Vector</a></li>
<li><a href="#encoding-nested-arrays">Encoding Nested Arrays</a></li>
<li><a href="#encoding-2d-array">Encoding 2 Dimensional Array Version</a></li>
</ul>
</li>
<li><a href="#encoding-hash-tables">Encoding hash-tables</a>
<ul>
<li><a href="#using-string-as-a-key">Using string as key</a></li>
<li><a href="#using-symbol-as-a-key">Using symbol as key</a></li>
</ul>
</li>
<li><a href="#encoding-objects">Encoding CLOS objects</a></li>
<li><a href="#encoding-structs">Encoding Structs</a></li>
<li><a href="#incremental-encoding">Incremental Encoding</a></li>
</ul>
</li>
<li><a href="#symmetry">Symmetry</a>
<ul>
<li><a href="#symmetry-json-cl-json">JSON -> CL -> JSON</a>
<ul>
<li><a href="#symmetry-json-cl-json1">First test (Easy)</a></li>
<li><a href="#symmetry-json-cl-json2">Second Test (Array Inside a JSON Object)</a></li>
<li><a href="#symmetry-json-cl-json3">Third test (Trickier Data Types)</a></li>
</ul>
</li>
<li><a href="#symmetry-cl-json-cl">CL -> JSON -> CL</a></li>
</ul>
</li>
<li><a href="#security">Security</a></li>
<li><a href="#standard-conformity">Standard Conformity and Dealing with Malformed Data</a>
<ul>
<li><a href="#conformity-testing">Conformity Testing</a>
<ul>
<li><a href="#must-accept">Must Accept</a></li>
<li><a href="#can-accept">Can Accept or Reject</a></li>
</ul>
</li>
<li><a href="#malformed-data">Malformed Data</a></li>
</ul>
</li>
<li><a href="#benchmarking">Benchmarking</a>
<ul>
<li><a href="#read-times">Read Times</a>
<ul>
<li><a href="#benchmarking-read-stream">Read Times From Stream (SBCL)</a></li>
</ul>
</li>
<li><a href="#write-times">Write Times</a></li>
</ul>
</li>
<li><a href="#json-libraries-specific-comments">JSON Libraries Specific Comments</a>
<ul>
<li><a href="#boost-json">boost-json</a>
<ul>
<li><a href="#boost-json-mapping">Default Mapping</a></li>
<li><a href="#boost-json-decoding">Decoding</a></li>
<li><a href="#boost-json-encoding">Encoding</a></li>
<li><a href="#boost-json-symmetry">Symmetry</a></li>
<li><a href="#boost-json-security">Security</a></li>
<li><a href="#boost-json-conformity">Conformity with JSON Standard</a></li>
<li><a href="#boost-json-benchmarkiing">Benchmarking</a></li>
<li><a href="#boost-json-exported-symbols">boost-json exported symbols</a></li>
</ul>
</li>
<li><a href="#cl-json">cl-json</a>
<ul>
<li><a href="#cl-json-mapping">Default Mapping</a></li>
<li><a href="#cl-json-decoding">Decoding</a></li>
<li><a href="#cl-json-encoding">Encoding</a></li>
<li><a href="#cl-json-symmetry">Symmetry</a></li>
<li><a href="#cl-json-security">Security</a></li>
<li><a href="#cl-json-conformity">Conformity with JSON Standard</a></li>
<li><a href="#cl-json-benchmarking">Benchmarking</a></li>
<li><a href="#cl-json-other-information">Miscellaneous Information</a></li>
<li><a href="#cl-json-exported-symbols">cl-json exported symbols</a></li>
</ul>
</li>
<li><a href="#com.gigamonkeys.json">com.gigamonkeys.json</a>
<ul>
<li><a href="#gigamonkeys-mapping">Default Mapping</a></li>
<li><a href="#gigamonkeys-decoding">Decoding</a></li>
<li><a href="#gigamonkeys-encoding">Encoding</a></li>
<li><a href="#gigamonkeys-symmetry">Symmetry</a></li>
<li><a href="#gigamonkeys-security">Security</a></li>
<li><a href="#gigamonkeys-conformity">Conformity with JSON Standard</a></li>
<li><a href="#gigamonkeys-benchmarking">Benchmarking</a></li>
<li><a href="#gigamonkeys-exported-symbols">com.gigamonkeys.json exported symbols</a></li>
</ul>
</li>
<li><a href="#com.inuoe.jzon">com.inuoe.jzon</a>
<ul>
<li><a href="#jzon-mapping">Default Mapping</a></li>
<li><a href="#jzon-decoding">Decoding</a></li>
<li><a href="#jzon-encoding">Encoding</a></li>
<li><a href="#jzon-symmetry">Symmetry</a></li>
<li><a href="#jzon-security">Security</a></li>
<li><a href="#jzon-conformity">Conformity with JSON Standard</a></li>
<li><a href="#jzon-benchmarking">Benchmarking</a></li>
<li><a href="#jzon-exported-symbols">com.inuoe.jzon exported symbols</a></li>
</ul>
</li>
<li><a href="#jonathan">jonathan</a>
<ul>
<li><a href="#jonathan-mapping">Default Mappping</a></li>
<li><a href="#jonathan-decoding">Decoding</a></li>
<li><a href="#jonathan-encoding">Encoding</a></li>
<li><a href="#jonathan-symmetry">Symmetry</a></li>
<li><a href="#jonathan-security">Security</a></li>
<li><a href="#jonathan-conformity">Conformity with JSON Standard</a></li>
<li><a href="#jonathan-benchmarking">Benchmarking</a></li>
<li><a href="#jonathan-exported-symbols">jonathan exported symbols</a></li>
</ul>
</li>
<li><a href="#json-lib">json-lib</a>
<ul>
<li><a href="#json-lib-mapping">Mapping</a></li>
<li><a href="#json-lib-decoding">Decoding</a></li>
<li><a href="#json-lib-encoding">Encoding</a></li>
<li><a href="#json-lib-symmetry">Symmetry</a></li>
<li><a href="#json-lib-security">Security</a></li>
<li><a href="#json-lib-conformity">Conformity with JSON Standard</a></li>
<li><a href="#json-lib-benchmarking">Benchmarking</a></li>
<li><a href="#json-lib-miscellaneous-comments">Miscellaneous Comments</a></li>
<li><a href="#json-lib-exported-symbols">Json-lib exported symbols</a></li>
</ul>
</li>
<li><a href="#json-streams">json-streams</a>
<ul>
<li><a href="#json-streams-mapping">Default Mapping</a></li>
<li><a href="#json-streams-decoding">Decoding</a></li>
<li><a href="#json-streams-encoding">Encoding</a></li>
<li><a href="#json-streams-symmetry">Symmetry</a></li>
<li><a href="#json-streams-security">Security</a></li>
<li><a href="#json-streams-conformity">Conformity with JSON Standard</a></li>
<li><a href="#json-streams-benchmarking">Benchmarking</a></li>
<li><a href="#json-streams-exported-symbols">json-streams exported symbols</a></li>
</ul>
</li>
<li><a href="#jsown">jsown</a>
<ul>
<li><a href="#jsown-mapping">Default Mappping</a></li>
<li><a href="#jsown-decoding">Decoding</a></li>
<li><a href="#jsown-encoding">Encoding</a></li>
<li><a href="#jsown-symmetry">Symmetry</a></li>
<li><a href="#jsown-security">Security</a></li>
<li><a href="#jsown-conformity">Conformity with JSON Standard</a></li>
<li><a href="#jsown-benchmarking">Benchmarking</a></li>
<li><a href="#jsown-miscellaneous">Miscellaneous</a></li>
<li><a href="#jsown-exported-symbols">jsown exported symbols</a></li>
</ul>
</li>
<li><a href="#shasht">shasht</a>
<ul>
<li><a href="#shasht-mapping">Default Mappping</a></li>
<li><a href="#shasht-decoding">Decoding</a></li>
<li><a href="#shasht-encoding">Encoding</a></li>
<li><a href="#shasht-symmetry">Symmetry</a></li>
<li><a href="#shasht-security">Security</a></li>
<li><a href="#shasht-conformity">Conformity with JSON Standard</a></li>
<li><a href="#shasht-benchmarking">Benchmarking</a></li>
<li><a href="#shasht-exported-symbols">Shasht Exported Symbols</a></li>
</ul>
</li>
<li><a href="#st-json">st-json</a>
<ul>
<li><a href="#st-json-mapping">Default Mappping</a></li>
<li><a href="#st-json-decoding">Decoding</a></li>
<li><a href="#st-json-encoding">Encoding</a></li>
<li><a href="#st-json-symmetry">Symmetry</a></li>
<li><a href="#st-json-security">Security</a></li>
<li><a href="#st-json-conformity">Conformity with JSON Standard</a></li>
<li><a href="#st-json-benchmarking">Benchmarking</a></li>
<li><a href="#st-json-other-information">Other Information</a></li>
<li><a href="#st-json-exported-symbols">st-json exported symbols</a></li>
</ul>
</li>
<li><a href="#trivial-json-codec">trivial-json-codec</a>
<ul>
<li><a href="#trivial-json-codec-mapping">Default Mappping</a></li>
<li><a href="#trivial-json-codec-decoding">Decoding</a></li>
<li><a href="#trivial-json-codec-encoding">Encoding</a></li>
<li><a href="#trivial-json-codec-symmetry">Symmetry</a></li>
<li><a href="#trivial-json-codec-security">Security</a></li>
<li><a href="#trivial-json-codec-conformity">Conformity with JSON Standard</a></li>
<li><a href="#trivial-json-codec-benchmarking">Benchmarking</a></li>
<li><a href="#trivial-json-codec-exported-symbols">trivial-json-codec exported symbols</a></li>
</ul>
</li>
<li><a href="#yason">yason</a>
<ul>
<li><a href="#yason-mapping">Mapping DataTypes and Structures</a></li>
<li><a href="#yason-decoding">Decoding</a></li>
<li><a href="#yason-encloding">Encoding</a></li>
<li><a href="#yason-symmetry">Symmetry</a></li>
<li><a href="#yason-security">Security</a></li>
<li><a href="#yason-conformity">Conformity with JSON Standard</a></li>
<li><a href="#yason-benchmarking">Benchmarking</a></li>
<li><a href="#yason-exported-symbols">yason exported symbols</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#helper-libraries">Helper Libraries</a>
<ul>
<li><a href="#cl-json-helper">cl-json-helper</a>
<ul>
<li><a href="#cl-json-helper-exported-symbols">cl-json-helper exported symbols</a></li>
<li><a href="#json-bool">Json-bool</a></li>
<li><a href="#json-empty">json-empty</a></li>
<li><a href="#json-key-value">Json-key-value</a></li>
</ul>
</li>
<li><a href="#define-json-expander">define-json-expander</a>
<ul>
<li><a href="#define-json-expander-exported-symbols">define-json-expander exported symbols</a></li>
<li><a href="#define-json-expander-explanation">Explanation</a></li>
</ul>
</li>
<li><a href="#herodotus">herodotus</a>
<ul>
<li><a href="#herodotus-exported-symbols">herodotus exported symbols</a></li>
<li><a href="#herodotus-setup">Setup</a></li>
<li><a href="#herodotus-decoding">Decoding</a></li>
<li><a href="#herodotus-encoding">Encoding</a></li>
<li><a href="#herodotus-additional-info">Additional Info</a></li>
</ul>
</li>
<li><a href="#json-mop">json-mop</a>
<ul>
<li><a href="#json-mop-exported-symbols">json-mop exported symbols</a></li>
</ul>
</li>
<li><a href="#cl-json-pointer">cl-json-pointer</a>
<ul>
<li><a href="#cl-json-pointer-exported-symbols">cl-json-pointer exported symbols</a></li>
</ul>
</li>
<li><a href="#cl-json-schema">cl-json-schema</a></li>
</ul>
</li>
<li><a href="#appendix">Appendix</a>
<ul>
<li><a href="#json-refresher">JSON Refresher</a></li>
<li><a href="#decoding-benchmark-detail">Decoding Trivial-Benchmark Summary</a></li>
<li><a href="#decoding-benchmark-detail-by-library">Decoding Trivial-Benchmark Detail By Library</a>
<ul>
<li><a href="#decoding-benchmark-detail-by-library12">1.2 MB JSON File</a></li>
<li><a href="#decoding-benchmark-detail-by-library98">9.8 MB File</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</nav>
<div id="outline-container-changelog" class="outline-2">
<h2 id="changelog">Changelog</h2>
<div class="outline-text-2" id="text-changelog">
</div>
<div id="outline-container-org16dc0f5" class="outline-3">
<h3 id="org16dc0f5">15 May 2023</h3>
<div class="outline-text-3" id="text-org16dc0f5">
<p>
Picks up regressions in com.inuoe.jzon. It has dropped its heuristics for handling lists. This can change the resulting data type and co-incidentally has dropped the ability to handle dotted lists. This last is likely to be corrected in the future.
</p>
</div>
</div>
<div id="outline-container-org618b58a" class="outline-3">
<h3 id="org618b58a">12 Apr 2023</h3>
<div class="outline-text-3" id="text-org618b58a">
<p>
com.inuoe.jzon (aka jzon) is now in quicklisp. Both jzon and shasht have had active development. The versions used are the github repositories as of 11 Apr 2023. Benchmarking has been updated.
</p>
<p>
A summary of changes in jzon:
</p>
<ol class="org-ol">
<li>incremental parsing and writing are now implemented</li>
<li>The issue with empty object on pathname has been 'fixed' - we now coerce to namestring</li>
<li>Float<->JSON encoding/decoding have both been substantially improved in terms of speed, accuracy, and portability across lisp implementations (bundled float encoder/decoder)</li>
<li>Parsing is now safe on the stack regardless of object nesting setting</li>
<li>Parsing performance improvements across the board for a variety of file sizes/varieties</li>
<li>Coerce strings to simple-base-string when possible for 1/4 memory usage on SBCL (ASCII vs UTF32 encoding) with minimal overhead.</li>
<li>New :allow-trailing-comma, and block comment support for :allow-comments in order to allow for parsing jwcc data (<a href="https://nigeltao.github.io/blog/2021/json-with-commas-comments.html">https://nigeltao.github.io/blog/2021/json-with-commas-comments.html</a>)</li>
<li>Much more detailed errors across the board when a parse error occurs</li>
</ol>
<p>
Changes in shasht include adding read-level and read-length limits to address potential security concerns. (These are set to nil by default).
</p>
</div>
</div>
<div id="outline-container-org04592be" class="outline-3">
<h3 id="org04592be">1 Feb 2022</h3>
<div class="outline-text-3" id="text-org04592be">
<p>
Picks up updates in shasht and now includes warnings on libraries with safety 0 (<code>jsown</code>, <code>jonathan</code>, <code>st-json</code>).
</p>
</div>
</div>
<div id="outline-container-orgf90c510" class="outline-3">
<h3 id="orgf90c510">19 Jan 2022</h3>
<div class="outline-text-3" id="text-orgf90c510">
<p>
Updated shasht for fixes in character, 2D arrays, and nil handling. Fixed some typos, including a missing earmuff.
</p>
</div>
</div>
<div id="outline-container-org2a05bb0" class="outline-3">
<h3 id="org2a05bb0">18 Jan 2022</h3>
<div class="outline-text-3" id="text-org2a05bb0">
<p>
Corrected JSON conformity tests on <code>boost-json</code>, <code>cl-json</code>, <code>json-lib</code>, <code>shasht</code>, <code>st-json</code>, <code>trivial-json-codec</code> and <code>yason</code>. If <code>*read-default-float-format*</code> is set to <code>'single-float</code>, those libraries would refuse to accept: <code>"[123e65]"</code>, <code>"[123e45]"</code> and <code>"[123.456e78]"</code>. If <code>*read-default-float-format*</code> is set to <code>'double-float</code>, then those JSON strings would be correctly accepted. Net result: with that caveat, <a href="#boost-json">boost-json</a>, <a href="#cl-json">cl-json</a>, <a href="#com.gigamonkeys.json">com.gigamonkeys.json</a>, <a href="#com.inuoe.jzon">com.inuoe.jzon</a>, <a href="#json-lib">json-lib</a>, <a href="#shasht">shasht</a>, <a href="#st-json">st-json</a> and <a href="#yason">yason</a> all score 95/95 on the JSON strings that must be accepted. See <a href="#must-accept">Standard Conformity - Must Accept</a>.
</p>
</div>
</div>
<div id="outline-container-org5277fba" class="outline-3">
<h3 id="org5277fba">15 Jan 2022</h3>
<div class="outline-text-3" id="text-org5277fba">
<p>
Complete rewrite of 1st edition.
</p>
</div>
</div>
</div>
<div id="outline-container-introduction" class="outline-2">
<h2 id="introduction">Introduction</h2>
<div class="outline-text-2" id="text-introduction">
<p>
The Common Lisp (CL) landscape with respect to JSON libraries has changed since the first edition of this review eight years ago. While I sometimes complain about someone writing new libraries when there are already so many, there have been major improvements and a couple of the new generation of CL JSON libraries are actually quite exciting. It still remains the case, however, that your choice of data structures for your application may drive your choice of JSON library, and vice versa. Like everything else in life, there are trade-offs to be made and I hope this paper helps you think about what may or may not be relevant for your situation.
</p>
<p>
Corrections to this report are welcomed. Please submit issues to <a href="https://github.com/sabracrolleton/sabracrolleton.github.io">https://github.com/sabracrolleton/sabracrolleton.github.io</a> or pull requests against the json-view.org file.
</p>
</div>
<div id="outline-container-libraries" class="outline-3">
<h3 id="libraries">Common Lisp Encoding and Decoding Libraries</h3>
<div class="outline-text-3" id="text-libraries">
<p>
CL currently has at least twelve libraries that address importing and exporting JSON data. The libraries considered in this report are listed in the table below. (For purposes of this comparison, I will refer to "encoding" as converting from CL to JSON and "decoding" or "parsing" as converting from JSON to CL.)
</p>
<table border="2" rules="all" frame="border">
<caption class="t-above"><span class="table-number">Table 1:</span> Common Lisp JSON Libraries Compared</caption>
<colgroup>
<col class="org-left">
<col class="org-left">
<col class="org-left">
<col class="org-left">
<col class="org-left">
<col class="org-left">
</colgroup>
<thead>
<tr>
<th scope="col" class="org-left">Library</th>
<th scope="col" class="org-left">Author</th>
<th scope="col" class="org-left">License</th>
<th scope="col" class="org-left">Website</th>
<th scope="col" class="org-left">Quicklisp?</th>
<th scope="col" class="org-left">Updated</th>
</tr>
</thead>
<tbody>
<tr>
<td class="org-left"><a href="#boost-json">boost-json</a></td>
<td class="org-left">Jeffrey Massung</td>
<td class="org-left">Apache</td>
<td class="org-left"><a href="https://github.com/cl-boost/json">homepage</a></td>
<td class="org-left">No</td>
<td class="org-left">16 Dec 2021</td>
</tr>
<tr>
<td class="org-left"><a href="#cl-json">cl-json</a></td>
<td class="org-left">Henrik Hjelte, Boris Smilga, Robert Goldman</td>
<td class="org-left">MIT</td>
<td class="org-left"><a href="https://github.com/hankhero/cl-json">homepage</a></td>
<td class="org-left">Yes</td>
<td class="org-left">7 Nov 2014</td>
</tr>
<tr>
<td class="org-left"><a href="#com.gigamonkeys.json">com.gigamonkeys.json</a></td>
<td class="org-left">Peter Seibel</td>
<td class="org-left">BSD-3</td>
<td class="org-left"><a href="https://github.com/gigamonkey/monkeylib-json">homepage </a></td>
<td class="org-left">Yes</td>
<td class="org-left">15 Apr 2017</td>
</tr>
<tr>
<td class="org-left"><a href="#com.inuoe.jzon">com.inuoe.jzon</a></td>
<td class="org-left">Wilfredo Velázquez-Rodríguez</td>
<td class="org-left">MIT</td>
<td class="org-left"><a href="https://github.com/Zulu-Inuoe/jzon">homepage</a></td>
<td class="org-left">Yes</td>
<td class="org-left">20 Mar 2023</td>
</tr>
<tr>
<td class="org-left"><a href="#jonathan">jonathan</a></td>
<td class="org-left">Rudolph Miller</td>
<td class="org-left">MIT</td>
<td class="org-left"><a href="https://github.com/Rudolph-Miller/jonathan">homepage</a></td>
<td class="org-left">Yes</td>
<td class="org-left">1 Sep 2020</td>
</tr>
<tr>
<td class="org-left"><a href="#json-lib">json-lib</a></td>
<td class="org-left">Alex Nygren</td>
<td class="org-left">MIT</td>
<td class="org-left"><a href="https://github.com/KinaKnowledge/json-lib">homepage</a></td>
<td class="org-left">Yes</td>
<td class="org-left">22 Oct 2022</td>
</tr>
<tr>
<td class="org-left"><a href="#json-streams">json-streams</a></td>
<td class="org-left">Thomas Bakketun, Stian Sletner</td>
<td class="org-left">GPL3</td>
<td class="org-left"><a href="http://github.com/rotatef/json-streams">homepage</a></td>
<td class="org-left">Yes</td>
<td class="org-left">12 Oct 2017</td>
</tr>
<tr>
<td class="org-left"><a href="#jsown">jsown</a></td>
<td class="org-left">Aad Versteden</td>
<td class="org-left">MIT</td>
<td class="org-left"><a href="https://github.com/madnificent/jsown">homepage</a></td>
<td class="org-left">Yes</td>
<td class="org-left">4 Feb 2020</td>
</tr>
<tr>
<td class="org-left"><a href="#shasht">shasht</a></td>
<td class="org-left">Tarn W. Burton</td>
<td class="org-left">MIT</td>
<td class="org-left"><a href="https://github.com/yitzchak/shasht">homepage</a></td>
<td class="org-left">Yes</td>
<td class="org-left">23 Feb 2023</td>
</tr>
<tr>
<td class="org-left"><a href="#st-json">st-json</a></td>
<td class="org-left">Marijn Haverbeke</td>
<td class="org-left">zlib</td>
<td class="org-left"><a href="https://github.com/marijnh/ST-JSON">homepage</a></td>
<td class="org-left">Yes</td>
<td class="org-left">28 Jun 2021</td>
</tr>
<tr>
<td class="org-left"><a href="#trivial-json-codec">trivial-json-codec</a> (2)</td>
<td class="org-left">Eric Diethelm</td>
<td class="org-left">MIT</td>
<td class="org-left"><a href="https://gitlab.com/ediethelm/trivial-json-codec">homepage</a></td>
<td class="org-left">Yes</td>
<td class="org-left">26 Apr 2022</td>
</tr>
<tr>
<td class="org-left"><a href="#yason">yason</a> (1)</td>
<td class="org-left">Hans Huebner</td>
<td class="org-left">BSD</td>
<td class="org-left"><a href="https://github.com/phmarek/yason">homepage</a></td>
<td class="org-left">Yes</td>
<td class="org-left">2 Feb 2023</td>
</tr>
</tbody>
</table>
<ul class="org-ul">
<li>(1) IMPORTANT: Notice the GitHub location has moved. Hans Huebner's old GitHub location will automatically redirect to Phil Marek's.</li>
<li>(2) trivial-json-codec seems more targeted at decoding from JSON to CL than serializing to JSON. Its main purpose is in serializing JSON data to CLOS hierarchical objects.</li>
</ul>
<table border="2" rules="all" frame="border">
<caption class="t-above"><span class="table-number">Table 2:</span> Dependencies</caption>
<colgroup>
<col class="org-left">
<col class="org-left">
</colgroup>
<thead>
<tr>
<th scope="col" class="org-left">Library</th>
<th scope="col" class="org-left">Dependencies</th>
</tr>
</thead>
<tbody>
<tr>
<td class="org-left"><a href="#boost-json">boost-json</a></td>
<td class="org-left"> </td>
</tr>
<tr>
<td class="org-left"><a href="#cl-json">cl-json</a></td>
<td class="org-left"> </td>
</tr>
<tr>
<td class="org-left"><a href="#com.gigamonkeys.json">com.gigamonkeys.json</a></td>
<td class="org-left"> </td>
</tr>
<tr>
<td class="org-left"><a href="#com.inuoe.jzon">com.inuoe.jzon</a></td>
<td class="org-left">closer-mop, flexi-streams, trivial-gray-streams, uiop and float-features (except when using ECL)</td>
</tr>
<tr>
<td class="org-left"><a href="#jonathan">jonathan</a></td>
<td class="org-left">cl-syntax, cl-syntax-annot, fast-io, trivial-types, babel, proc-parse, cl-ppcre, cl-annot</td>
</tr>
<tr>
<td class="org-left"><a href="#json-lib">json-lib</a></td>
<td class="org-left">alexandria, str, parse-float, cl-fad, babel</td>
</tr>
<tr>
<td class="org-left"><a href="#json-streams">json-streams</a></td>
<td class="org-left"> </td>
</tr>
<tr>
<td class="org-left"><a href="#jsown">jsown</a></td>
<td class="org-left"> </td>
</tr>
<tr>
<td class="org-left"><a href="#shasht">shasht</a></td>
<td class="org-left">trivial-do, closer-mop</td>
</tr>
<tr>
<td class="org-left"><a href="#st-json">st-json</a></td>
<td class="org-left"> </td>
</tr>
<tr>
<td class="org-left"><a href="#trivial-json-codec">trivial-json-codec</a></td>
<td class="org-left">trivial-utilities, log4cl, closer-mop, iterate, parse-number</td>
</tr>
<tr>
<td class="org-left"><a href="#yason">yason</a></td>
<td class="org-left">alexandria, trivial-gray-streams</td>
</tr>
</tbody>
</table>
</div>
</div>
<div id="outline-container-helper-libraries-top" class="outline-3">
<h3 id="helper-libraries-top">Helper Libraries</h3>
<div class="outline-text-3" id="text-helper-libraries-top">
<p>
We should also talk a bit about some helper libraries.
</p>
<table>
<colgroup>
<col class="org-left">
<col class="org-left">
<col class="org-left">
<col class="org-left">
<col class="org-left">
<col class="org-left">
</colgroup>
<thead>
<tr>
<th scope="col" class="org-left">Library</th>
<th scope="col" class="org-left">Author</th>
<th scope="col" class="org-left">License</th>
<th scope="col" class="org-left">Website</th>
<th scope="col" class="org-left">Works With</th>
<th scope="col" class="org-left">Comments</th>
</tr>
</thead>
<tbody>
<tr>
<td class="org-left"><a href="#define-json-expander">define-json-expander</a></td>
<td class="org-left">Johan Sjölén</td>
<td class="org-left">MIT</td>
<td class="org-left"><a href="https://github.com/ejbs/define-json-expander">homepage</a></td>
<td class="org-left">cl-json</td>
<td class="org-left">CLOS<->JSON</td>
</tr>
<tr>
<td class="org-left"><a href="#herodotus">herodotus</a></td>
<td class="org-left">Henry Steere</td>
<td class="org-left">BSD (1)</td>
<td class="org-left"><a href="https://github.com/HenryS1/herodotus">homepage</a></td>
<td class="org-left">yason</td>
<td class="org-left">CLOS<->JSON</td>
</tr>
<tr>
<td class="org-left"><a href="#json-mop">json-mop</a></td>
<td class="org-left">Grim Schjetne</td>
<td class="org-left">MIT</td>
<td class="org-left"><a href="https://github.com/gschjetne/json-mop">homepage</a></td>
<td class="org-left">yason</td>
<td class="org-left">CLOS<->JSON</td>
</tr>
<tr>
<td class="org-left"><a href="#cl-json-helper">cl-json-helper</a></td>
<td class="org-left">Bob Felts</td>
<td class="org-left">BSD</td>
<td class="org-left"><a href="https://github.com/stablecross/cl-json-helper">homepage</a></td>
<td class="org-left">cl-json</td>
<td class="org-left"> </td>
</tr>
<tr>
<td class="org-left"><a href="#cl-json-schema">cl-json-schema</a></td>
<td class="org-left">Mark Skilbeck</td>
<td class="org-left">MIT</td>
<td class="org-left"><a href="https://github.com/notmgsk/cl-json-schema">homepage</a></td>
<td class="org-left"> </td>
<td class="org-left"> </td>
</tr>
<tr>
<td class="org-left"><a href="#cl-json-pointer">cl-json-pointer</a></td>
<td class="org-left">Yokata Yuki</td>
<td class="org-left">MIT</td>
<td class="org-left"><a href="https://github.com/y2q-actionman/cl-json-pointer">homepage</a></td>
<td class="org-left">cl-json, st-json, yason, <code>jsown</code>, jonathan, json-streams, com.gigamonkeys.json, (1)</td>
<td class="org-left"><a href="https://40ants.com/lisp-project-of-the-day/2020/08/0158-cl-json-pointer.html">40ants comments</a></td>
</tr>
</tbody>
</table>
<ul class="org-ul">
<li>(1) asd file says BSD, but license included is MIT.</li>
</ul>
</div>
</div>
</div>
<div id="outline-container-quick-summary" class="outline-2">
<h2 id="quick-summary">Quick Summary</h2>
<div class="outline-text-2" id="text-quick-summary">
<p>
As can be expected, the libraries do much of the same if you have basic needs. However, differences exist and should be considered in choosing which library is right for any particular project. Many applications are asymmetric in how they will use these libraries, so consider the strengths and weakness given the needs of your case. Library links are to the libraries' individual sections below.
</p>
<ul class="org-ul">
<li><b>Overall:</b> I quite like the newcomers <a href="#shasht">shasht</a> and <a href="#com.inuoe.jzon">com.inuoe.jzon</a>. <a href="#cl-json">cl-json</a> and <a href="#yason">yason</a> are still the work horses if you need fine control, but speed is not their forte.</li>
<li><b>Decoding or Parsing Speed:</b> Speed is not everything, but seems to be important to a lot of readers. If you are parsing compliant data and are just looking for speed, look at <a href="#jsown">jsown</a>, <a href="#com.inuoe.jzon">com.inuoe.jzon</a> or <a href="#shasht">shasht</a>. <a href="#jonathan">Jonathan</a> is faster on tiny strings but starts to slow down with nested objects and eventually, depending on the size of the JSON object, becomes orders of magnitude slower than the other libraries. The effect was seen faster under SBCL but as data file size increased, it was also obvious under CCL and ECL as well. See <a href="#read-times">read-times</a></li>
<li><b>Encoding Speed:</b> If you mostly need to encode lisp data to JSON and are just looking for speed, I would look at <a href="#com.inuoe.jzon">com.inuoe.jzon</a>, <a href="#shasht">shasht</a> or depending on your data, <a href="#jonathan">jonathan</a> or <a href="#st-json">st-json</a>. See <a href="#write-times">write-times</a></li>
<li><b>Safety 0</b> Three libraries (<code>jsown</code>, jonathan and st-json) have optimize set for safety 0 to increase speed. This has bitten some users hard in the past, so you have been warned. If you restrict safety to 2 or 3 on SBCL, <a href="#jonathan">Jonathan</a> is unable to parse floats. See <a href="https://github.com/rudolph-miller/jonathan/issues/66">https://github.com/rudolph-miller/jonathan/issues/66</a></li>
<li><b>Unicode Handling:</b> Most of the libraries can handle unicode. However, if you have unicode surrogate pairs, you need to choose from <a href="#com.inuoe.jzon">com.inuoe.jzon</a>, <a href="#jonathan">jonathan</a>, <a href="#json-streams">json-streams</a>, <a href="#jsown">jsown</a>, <a href="#shasht">shasht</a>, <a href="#st-json">st-json</a> or <a href="#yason">yason</a>. See <a href="#decode-unicode">Decoding Unicode</a>.</li>
<li><b>Extracting Subsets:</b> If you want to extract a subset of JSON data without paying attention to everything else, <a href="#jsown-filters">jsown</a> is the choice. <a href="#jonathan">Jonathan</a> allows you to get a key:value pair, but I could only use it one level deep. Obviously every library can import all the JSON data into some CL datastructure and then use standard CL functionality to get whatever subset you want.</li>
<li><b>Handling all proper JSON forms:</b> If you remember to set *read-default-float-format* to 'double-float, there is no clear winner. <a href="#boost-json">boost-json</a>, <a href="#cl-json">cl-json</a>, <a href="#com.gigamonkeys.json">com.gigamonkeys.json</a>, <a href="#com.inuoe.jzon">com.inuoe.jzon</a>, <a href="#json-lib">json-lib</a>, <a href="#shasht">shasht</a>, <a href="#st-json">st-json</a> and <a href="#yason">yason</a> all score 95/95 on the JSON standard conformity tests that must be met. If *read-default-float-format* is set to to 'single-float, only <a href="#com.inuoe.jzon">com.inuoe.jzon</a> and <a href="#com.gigamonkeys.json">com.gigamonkeys.json</a> have perfect scores. See <a href="#must-accept">Must Accept</a>.</li>
<li><b>Handling potentially invalid data:</b> See <a href="#standard-conformity">Standard Conformity and Dealing with Malformed Data</a>. I think <a href="#com.inuoe.jzon">com.inuoe.jzon</a> is the winner..</li>
<li><b>Proper Distinction Between NULL/Nil/False:</b> <a href="#com.inuoe.jzon">Com.inuoe.jzon</a>, <a href="#shasht">shasht</a> and <a href="#st-json">st-json</a> get it right out of the box. <a href="#jonathan">jonathan</a> and <a href="#yason">yason</a> provide the ability to get there with setting a simple variable.</li>
<li><b>CLOS Abilities - Decoding:</b> <a href="#trivial-json-codec">Trivial-json-codec</a> can decode objects to standard pre-defined classes. <a href="#boost-json-decoding-to-clos">Boost-json</a> can decode JSON objects to a boost-json:json-object which is a standard object. <a href="#cl-json">Cl-json</a> has the ability to decode JSON objects into a "fluid-class" CLOS object. (Note, this is thread unsafe if you have not already prepped classes for every expected JSON object. If you define your own classes with a lispclass member, this can be avoided so long as every class is defined that way.) Personally I prefer being able to define my own classes. Trivial-json-codec then just dumps the JSON data into your classes. If you use <a href="#yason">yason</a>, I would also use the helper library <a href="#json-mop">json-mop</a>. (<a href="#com.inuoe.jzon">com.inuoe.jzon</a> decodes JSON to hash-tables, so does not have decoding to CLOS abilities out of the box.) See <a href="#decode-to-clos">Decoding to CLOS</a></li>
<li><b>CLOS Abilities - Encoding:</b> On the encoding side, <a href="#cl-json">cl-json</a>, <a href="#com.inuoe.jzon">com.inuoe.jzon</a>, <a href="#shasht">shasht</a> and <a href="#trivial-json-codec">trivial-json-codec</a> are able to encode CLOS objects to JSON out of the box. The rest of the libraries require that you write your own methods for your clos classes - which is not necessarily that difficult, but not something you get out of the box. If you like <a href="#yason">yason</a>, there are two helper libraries: <a href="#json-mop">json-mop</a> or <a href="#herodotus">herodotus</a>. I have a preference for <a href="#json-mop">json-mop</a> with the caveat that, at the moment, you cannot redefine classes. There is also a <a href="#cl-json">cl-json</a> helper library, <a href="#define-json-expander">define-json-expander</a>, which defines classses which can be used by cl-json to help move data back and forth. See <a href="#encoding-objects">Encoding Objects</a></li>
<li><b>Encoding different lisp types:</b> <a href="#shasht">shasht</a> and <a href="#com.inuoe.jzon">com.inuoe.jzon</a> were the best at encoding different lisp data types. For example, they were the only library able to handle structs without the user having to define a new method. There is a trade-off between handling multiple lisp types and symmetry. If you do not have a 1:1 matching but rather have a many:1 matching, there may be complications doing a round trip between JSON and CL and getting exactly the same data type or structure you started with. See <a href="#encoding">Encoding</a> or <a href="#encoding-data-structures">Encoding Data Structures</a>.</li>
<li><b>Incremental Encoding:</b> <a href="#cl-json-incremental">cl-json</a>, <a href="#jzon-incremental">com.inuoe.jzon</a> <a href="#jonathan-incremental">jonathan</a>, <a href="#json-streams-incremental">json-streams</a>, <a href="#jsown-incremental">jsown</a>, <a href="#shasht-incremental">shasht</a>, <a href="#st-json-incremental">st-json</a> and <a href="#yason-incremental">yason</a> all have the capability to do incremental encoding. You can see small examples in their individual sections at the links in the previous sentence. I found <a href="#shasht-incremental">shasht</a> a little easier. See <a href="#incremental-encoding">Incremental Encoding Discussion</a> for more detail.</li>
<li><b>Security issues:</b> Security issues are always a potential problem if you are getting data from uncontrolled sources. Malware disguised in the data will likely either be properly formed JSON strings that try to overload the system by overloading libraries using keywords as hash symbols or improperly formed JSON strings that exhaust the stack. See the <a href="#security">Security discussion</a> for more information. In cases facing data from uncontrolled sources, I would look first at <a href="#com.inuoe.jzon">com.inuoe.jzon</a> , then maybe at <a href="#shasht">shasht</a>. I would suggest that all libraries put some type of limit on parsing depth of JSON objects or arrays. At this point only <a href="#com.inuoe.jzon">com.inuoe.jzon</a>, <a href="#json-lib">json-lib</a>, <a href="#json-streams">json-streams</a> and <a href="#trivial-json-codec">trivial-json-codec</a> have such limits, all of which are configurable. See <a href="#security">security</a>.</li>
<li><b>Symmetry or "Round Tripping":</b> Symmetric treatment is important to some users. In this area, libraries tend to have issues with NULL/Nil/False as well as whether keys should be symbols or strings. Symmetry is easier going from Jason to CL and back. It is definitely harder if you go from CL to JSON and back to CL and you do not limit your CL data types. (CL has more data types so you do not have a 1:1 match). Your choices are to limit your CL data types or using libraries which allow you to precisely specify the CL datatype you want at that point. Overall, I think the symmetry winner is <a href="#shasht">shasht</a>, but your fact pattern may drive a different answer. See <a href="#symmetry">symmetry discussion</a>.</li>
</ul>
<p>
At the end of the day, your particular data and requirements will determine which library is best for any particular application. Webapps may have tiny bits of JSON going back and forth while other uses will be asymmetric - gigabytes of JSON getting imported and little or occasional amounts getting exported or vice versa. You may have different needs depending on whether the JSON encoded data is strictly controlled or it is coming in from unknown sources. In one test, yason:encode choked on a list which included a keyword :NULL in an unexpected location. Cl-json just encoded it as the string "null" and st-json encoded it as 'null' (not a string). In testing for your use, if you get JSON data from uncontrolled sources, deliberately feed badly formed data and see how the library reacts. Some will throw recoverable conditions (depending on the error) while others may actually lock up a thread.
</p>
</div>
</div>
<div id="outline-container-decoding" class="outline-2">
<h2 id="decoding">Decoding/Reading/Parsing JSON Data to Lisp</h2>
<div class="outline-text-2" id="text-decoding">
<p>
The following table shows the basic decoding function for a library and then specialist functions. Each will have more detail in the section specific to that library.
</p>
<table border="2" rules="all" frame="border">
<caption class="t-above"><span class="table-number">Table 3:</span> Basic Decoding Functions</caption>
<colgroup>
<col class="org-left">
<col class="org-left">
<col class="org-left">
</colgroup>
<thead>
<tr>
<th scope="col" class="org-left">Library</th>
<th scope="col" class="org-left">Base Function</th>
<th scope="col" class="org-left">Specialist Functions</th>
</tr>
</thead>
<tbody>
<tr>
<td class="org-left"><a href="#boost-json-decoding">boost-json</a></td>
<td class="org-left">json-decode</td>
<td class="org-left">json-read</td>
</tr>
<tr>
<td class="org-left"><a href="#cl-json-decoding">cl-json</a></td>
<td class="org-left">decode-json</td>
<td class="org-left">decode-json-from-source, decode-json-from-string, decode-json-strict</td>
</tr>
<tr>
<td class="org-left"><a href="#gigamonkeys-decoding">com.gigamonkeys.json</a></td>
<td class="org-left">parse-json</td>
<td class="org-left"> </td>
</tr>
<tr>
<td class="org-left"><a href="#jzon-decoding">com.inuoe.jzon</a></td>
<td class="org-left">parse</td>
<td class="org-left"> </td>
</tr>
<tr>
<td class="org-left"><a href="#jonathan-decoding">jonathan</a></td>
<td class="org-left">parse</td>
<td class="org-left"> </td>
</tr>
<tr>
<td class="org-left"><a href="#json-lib-decoding">json-lib</a></td>
<td class="org-left">parse</td>
<td class="org-left"> </td>
</tr>
<tr>
<td class="org-left"><a href="#json-streams-decoding">json-streams</a></td>
<td class="org-left">json-parse</td>
<td class="org-left">json-read</td>
</tr>
<tr>
<td class="org-left"><a href="#jsown-decoding">jsown</a></td>
<td class="org-left">parse</td>
<td class="org-left"> </td>
</tr>
<tr>
<td class="org-left"><a href="#shasht-decoding">shasht</a></td>
<td class="org-left">read-json</td>
<td class="org-left">read-json*</td>
</tr>
<tr>
<td class="org-left"><a href="#st-json-decoding">st-json</a></td>
<td class="org-left">read-json</td>
<td class="org-left">read-json-as-type read-json-from-string</td>
</tr>
<tr>
<td class="org-left"><a href="#trivial-json-codec-decoding">trivial-json-codec</a></td>
<td class="org-left">deserialize-raw</td>
<td class="org-left">deserialize-json</td>
</tr>
<tr>
<td class="org-left"><a href="#yason-decoding">yason</a> (1)</td>
<td class="org-left">parse</td>
<td class="org-left">parse-json-arrays-as-vectors, parse-json-booleans-as-symbols, parse-json-null-as-keyword, parse-object-as, parse-object-as-alist, parse-object-key-fn, symbol-key-encoder</td>
</tr>
</tbody>
</table>
<ul class="org-ul">
<li>(1) yason:parse takes keyword parameters :object-key-fn, :object-as :json-arrays-as-vectors :json-booleans-as-symbols :json-nulls-as-keyword</li>
</ul>
</div>
<div id="outline-container-decoding-streams-or-strings" class="outline-3">
<h3 id="decoding-streams-or-strings">Decoding Streams or Strings</h3>
<div class="outline-text-3" id="text-decoding-streams-or-strings">
<p>
Does the library take both strings and streams as input?
</p>
<table border="2" rules="all" frame="border">
<caption class="t-above"><span class="table-number">Table 4:</span> Strings and Streams As Input</caption>
<colgroup>
<col class="org-left">
<col class="org-left">
<col class="org-left">
</colgroup>
<thead>
<tr>
<th scope="col" class="org-left">Library</th>
<th scope="col" class="org-left">Strings</th>
<th scope="col" class="org-left">Streams</th>
</tr>
</thead>
<tbody>
<tr>
<td class="org-left">boost-json</td>
<td class="org-left">YES</td>
<td class="org-left">YES (1)</td>
</tr>
<tr>
<td class="org-left">cl-json</td>
<td class="org-left">YES</td>
<td class="org-left">YES</td>
</tr>
<tr>
<td class="org-left">com.gigamonkeys.json</td>
<td class="org-left">YES</td>
<td class="org-left">NO</td>
</tr>
<tr>
<td class="org-left">com.inuoe.jzon</td>
<td class="org-left">YES</td>
<td class="org-left">YES</td>
</tr>
<tr>
<td class="org-left">jonathan</td>
<td class="org-left">YES</td>
<td class="org-left">NO</td>
</tr>
<tr>
<td class="org-left">json-lib</td>
<td class="org-left">UTF-8 Encoded Only</td>
<td class="org-left">NO</td>
</tr>
<tr>
<td class="org-left">json-streams</td>
<td class="org-left">YES</td>
<td class="org-left">YES</td>
</tr>
<tr>
<td class="org-left"><code>jsown</code></td>
<td class="org-left">YES</td>
<td class="org-left">NO</td>
</tr>
<tr>
<td class="org-left">shasht</td>
<td class="org-left">YES</td>
<td class="org-left">YES</td>
</tr>
<tr>
<td class="org-left">st-json</td>
<td class="org-left">YES</td>
<td class="org-left">YES</td>
</tr>
<tr>
<td class="org-left">trivial-json-codec</td>
<td class="org-left">YES</td>
<td class="org-left">NO</td>
</tr>
<tr>
<td class="org-left">yason</td>
<td class="org-left">YES</td>
<td class="org-left">YES</td>
</tr>