MCPcopy
hub / github.com/uber-go/zap / NewJSONEncoder

Function NewJSONEncoder

zapcore/json_encoder.go:77–79  ·  zapcore/json_encoder.go::NewJSONEncoder

NewJSONEncoder creates a fast, low-allocation JSON encoder. The encoder appropriately escapes all field keys and values. Note that the encoder doesn't deduplicate keys, so it's possible to produce a message like {"foo":"bar","foo":"baz"} This is permitted by the JSON specification, but not encou

(cfg EncoderConfig)

Source from the content-addressed store, hash-verified

75// pair) when unmarshaling, but users should attempt to avoid adding duplicate
76// keys.
77func NewJSONEncoder(cfg EncoderConfig) Encoder {
78 return newJSONEncoder(cfg, false)
79}
80
81func newJSONEncoder(cfg EncoderConfig, spaced bool) *jsonEncoder {
82 if cfg.SkipLineEnding {

Callers 15

withBenchedLoggerFunction · 0.92
BenchmarkAddCallerHookFunction · 0.92
Benchmark100FieldsFunction · 0.92
TestSugarWithCapturesFunction · 0.92
encoder.goFile · 0.92
TestLoggerWithCapturesFunction · 0.92
TestLoggerWriteFailureFunction · 0.92
TestLoggerSyncFailFunction · 0.92
BenchmarkBoolsReflectFunction · 0.92
NewExampleFunction · 0.92

Calls 1

newJSONEncoderFunction · 0.85

Tested by 15

withBenchedLoggerFunction · 0.74
BenchmarkAddCallerHookFunction · 0.74
Benchmark100FieldsFunction · 0.74
TestSugarWithCapturesFunction · 0.74
TestLoggerWithCapturesFunction · 0.74
TestLoggerWriteFailureFunction · 0.74
TestLoggerSyncFailFunction · 0.74
BenchmarkBoolsReflectFunction · 0.74
ExampleAtomicLevelFunction · 0.74