aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/documentation/lux/data/format/json.lux
blob: 2051ee55cf0ac0e75943bd2b1ec9d462aae8a884 (plain)
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
(.require
 [library
  [lux (.except)
   ["$" documentation]
   [data
    [text (.only \n)
     ["%" \\format (.only format)]]]
   [macro
    ["[0]" template]]]]
 [\\library
  ["[0]" /]])

(`` (.def .public documentation
      (.List $.Module)
      ($.module /._
                (format "Functionality for reading and writing values in the JSON format."
                        \n "For more information, please see: http://www.json.org/")
                [($.default /.Null)
                 ($.default /.Boolean)
                 ($.default /.Number)
                 ($.default /.String)
                 ($.default /.JSON)
                 ($.default /.Array)
                 ($.default /.Object)
                 ($.default /.null?)
                 ($.default /.object)
                 ($.default /.equivalence)
                 ($.default /.format)
                 ($.default /.codec)

                 ($.documentation /.json
                   "A simple way to produce JSON literals."
                   ["null"
                    (json #null)]
                   ["true"
                    (json #1)]
                   ["123.456"
                    (json +123.456)]
                   ["'this is a string'"
                    (json "this is a string")]
                   ["['this' 'is' 'an' 'array']"
                    (json ["this" "is" "an" "array"])]
                   ["{'this' 'is', 'an' 'object'}"
                    (json {"this" "is" "an" "object"})])

                 ($.documentation /.fields
                   "Get all the fields in a JSON object."
                   [(fields json)])

                 ($.documentation /.field
                   "A JSON object field getter."
                   [(field key json)])

                 ($.documentation /.has
                   "A JSON object field setter."
                   [(has key value json)])

                 (~~ (with_template [<name> <desc>]
                       [($.documentation <name>
                          (format "A JSON object field getter for " <desc> "."))]

                       [/.boolean_field "booleans"]
                       [/.number_field  "numbers"]
                       [/.string_field  "strings"]
                       [/.array_field   "arrays"]
                       [/.object_field  "objects"]
                       ))]
                [])))