Skip to content

Commit

Permalink
geojson: update readmes for external jsonifier support
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmach committed Apr 15, 2022
1 parent 407c1b5 commit bb8773d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ for _, f := range fc {
}
```

The library supports third party "encoding/json" replacements
such [github.com/json-iterator/go](https://github.com/json-iterator/go).
See the [geojson](geojson) readme for more details.

## Mapbox Vector Tiles

The [encoding/mvt](encoding/mvt) sub-package implements Marshalling and
Expand Down
9 changes: 2 additions & 7 deletions geojson/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ fc.ExtraMembers["timestamp"] // == "2020-06-15T01:02:03Z"
// base featureCollection object.
```

## Performance Performance Performance
## Performance

If GeoJSON encoding/decoding performance is critical consider using a
For performance critical applications, consider a
third party replacement of "encoding/json" like [github.com/json-iterator/go](https://github.com/json-iterator/go)

This can be enabled with something like this:
Expand All @@ -82,7 +82,6 @@ import (
var c = jsoniter.Config{
EscapeHTML: true,
SortMapKeys: false,
ValidateJsonRawMessage: false,
MarshalFloatWith6Digits: true,
}.Froze()

Expand Down Expand Up @@ -126,7 +125,3 @@ f.Properties.MustFloat64(key string, def ...float64) float64
f.Properties.MustInt(key string, def ...int) int
f.Properties.MustString(key string, def ...string) string
```

```
```
4 changes: 2 additions & 2 deletions geojson/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ import "encoding/json"
// var c = jsoniter.Config{
// EscapeHTML: true,
// SortMapKeys: false,
// ValidateJsonRawMessage: false,
// MarshalFloatWith6Digits: true,
// }.Froze()
//
// orb.CustomJSONMarshaler = c
// orb.CustomJSONUnmarshaler = c
//
Expand All @@ -39,9 +39,9 @@ var CustomJSONMarshaler interface {
// var c = jsoniter.Config{
// EscapeHTML: true,
// SortMapKeys: false,
// ValidateJsonRawMessage: false,
// MarshalFloatWith6Digits: true,
// }.Froze()
//
// orb.CustomJSONMarshaler = c
// orb.CustomJSONUnmarshaler = c
//
Expand Down

0 comments on commit bb8773d

Please sign in to comment.