File tree Expand file tree Collapse file tree 3 files changed +32
-10
lines changed Expand file tree Collapse file tree 3 files changed +32
-10
lines changed Original file line number Diff line number Diff line change 2
2
3
3
[ ![ build-img]] [ build-url ]
4
4
[ ![ pkg-img]] [ pkg-url ]
5
- [ ![ reportcard-img]] [ reportcard-url ]
6
- [ ![ coverage-img]] [ coverage-url ]
7
5
[ ![ version-img]] [ version-url ]
8
6
9
7
Go package to easily construct JSON without defined types.
@@ -14,6 +12,8 @@ Go package to easily construct JSON without defined types.
14
12
* Dependency-free.
15
13
* Clean and tested code.
16
14
15
+ See [ docs] [ pkg-url ] for more details.
16
+
17
17
## Install
18
18
19
19
Go version 1.18+
@@ -50,10 +50,6 @@ fmt.Printf("%s\n", raw)
50
50
51
51
See examples: [ example_test.go] ( example_test.go ) .
52
52
53
- ## Documentation
54
-
55
- See [ these docs] [ pkg-url ] for more details.
56
-
57
53
## License
58
54
59
55
[ MIT License] ( LICENSE ) .
@@ -62,9 +58,5 @@ See [these docs][pkg-url] for more details.
62
58
[ build-url ] : https://github.com/cristalhq/jsn/actions
63
59
[ pkg-img ] : https://pkg.go.dev/badge/cristalhq/jsn
64
60
[ pkg-url ] : https://pkg.go.dev/github.com/cristalhq/jsn
65
- [ reportcard-img ] : https://goreportcard.com/badge/cristalhq/jsn
66
- [ reportcard-url ] : https://goreportcard.com/report/cristalhq/jsn
67
- [ coverage-img ] : https://codecov.io/gh/cristalhq/jsn/branch/main/graph/badge.svg
68
- [ coverage-url ] : https://codecov.io/gh/cristalhq/jsn
69
61
[ version-img ] : https://img.shields.io/github/v/release/cristalhq/jsn
70
62
[ version-url ] : https://github.com/cristalhq/jsn/releases
Original file line number Diff line number Diff line change @@ -31,6 +31,33 @@ func Example() {
31
31
//}
32
32
}
33
33
34
+ func ExampleAO () {
35
+ j := jsn.AO {
36
+ {"a" : 1 },
37
+ {"b" : 2 , "c" : 3 },
38
+ {"d" : jsn.O {"1" : "2" }},
39
+ }
40
+
41
+ raw , _ := json .MarshalIndent (j , "" , " " )
42
+ fmt .Printf ("%s\n " , raw )
43
+
44
+ // Output:
45
+ // [
46
+ // {
47
+ // "a": 1
48
+ // },
49
+ // {
50
+ // "b": 2,
51
+ // "c": 3
52
+ // },
53
+ // {
54
+ // "d": {
55
+ // "1": "2"
56
+ // }
57
+ // }
58
+ // ]
59
+ }
60
+
34
61
func ExampleNumber () {
35
62
j := jsn.O {
36
63
"x" : 123456.00000000000000000000000000000000000000001 ,
Original file line number Diff line number Diff line change @@ -6,6 +6,9 @@ type A = []any
6
6
// O represents JSON object.
7
7
type O = map [string ]any
8
8
9
+ // AO represents JSON array of JSON objects.
10
+ type AO = []O
11
+
9
12
// N represents JSON number.
10
13
type N string
11
14
You can’t perform that action at this time.
0 commit comments