Skip to content

Commit 670fb02

Browse files
committed
geojson: update the rest of the CustomJSONMarshaler comments
1 parent 5936cc3 commit 670fb02

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

geojson/README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,17 +81,18 @@ This can be enabled with something like this:
8181
```go
8282
import (
8383
jsoniter "github.com/json-iterator/go"
84-
"github.com/paulmach/orb"
84+
"github.com/paulmach/orb/geojson"
8585
)
8686

87-
var c = jsoniter.Config{
87+
// in an init() or main(), etc.
88+
c := jsoniter.Config{
8889
EscapeHTML: true,
8990
SortMapKeys: false,
9091
MarshalFloatWith6Digits: true,
9192
}.Froze()
9293

93-
CustomJSONMarshaler = c
94-
CustomJSONUnmarshaler = c
94+
geojson.CustomJSONMarshaler = c
95+
geojson.CustomJSONUnmarshaler = c
9596
```
9697

9798
The above change can have dramatic performance implications, see the benchmarks below

geojson/json.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import "encoding/json"
1212
// "github.com/paulmach/orb/geojson"
1313
// )
1414
//
15+
// // in an init() or main(), etc.
1516
// var c = jsoniter.Config{
1617
// EscapeHTML: true,
1718
// SortMapKeys: false,
@@ -33,17 +34,18 @@ var CustomJSONMarshaler interface {
3334
//
3435
// import (
3536
// jsoniter "github.com/json-iterator/go"
36-
// "github.com/paulmach/orb"
37+
// "github.com/paulmach/orb/geojson"
3738
// )
3839
//
39-
// var c = jsoniter.Config{
40+
// // in an init() or main(), etc.
41+
// c := jsoniter.Config{
4042
// EscapeHTML: true,
4143
// SortMapKeys: false,
4244
// MarshalFloatWith6Digits: true,
4345
// }.Froze()
4446
//
45-
// orb.CustomJSONMarshaler = c
46-
// orb.CustomJSONUnmarshaler = c
47+
// geojson.CustomJSONMarshaler = c
48+
// geojson.CustomJSONUnmarshaler = c
4749
//
4850
// Note that any errors encountered during unmarshaling will be different.
4951
var CustomJSONUnmarshaler interface {

0 commit comments

Comments
 (0)