Skip to content
This repository was archived by the owner on Dec 15, 2025. It is now read-only.
This repository was archived by the owner on Dec 15, 2025. It is now read-only.

json-iterator/go is not 100% compatible drop-in replacement of encoding/json #229

Open

Description

@choleraehyq

Several functions missing. Like Compact/Indent/HTMLEscape/Decoder.Token etc.

Activity

  1. changed the title [-]Missing Compact/Indent/HTMLEscape comparing to encoding/json[/-] [+]json-iterator/go is not 100% compatible drop-in replacement of encoding/json[/+] on Jan 28, 2018
  2. taowen commented on Jan 28, 2018

    @taowen
    Contributor

    no one is asking for them

  3. veqryn commented on Jul 23, 2018

    @veqryn

    HTML Escaping is supported through the following, I think:

    func jsonIteratorMarshalAddNewLineNoEscapeHTML(v interface{}) ([]byte, error) {
    	buffer := &bytes.Buffer{}
    	encoder := jsonIterator.NewEncoder(buffer)
    	encoder.SetEscapeHTML(false)
    	err := encoder.Encode(v)
    	return buffer.Bytes(), err
    }
  4. carbocation commented on Aug 6, 2018

    @carbocation

    The readme says "100% compatibility with standard lib". I think that if this line were removed, this issue could be resolved...

  5. shatil commented on Oct 20, 2018

    @shatil

    #313 relates to this. jsoniter doesn't support the Umarshaler interface: https://golang.org/pkg/encoding/json/#Unmarshaler

  6. jszwedko commented on Apr 13, 2020

    @jszwedko

    I agree that the README should be updated to convey which parts are not compatible with encoding/json and not say "100% compatible". There are a couple functions missing from the Decoder type:

            func (dec *Decoder) InputOffset() int64
            func (dec *Decoder) Token() (Token, error)
    

    I had wanted to try out switching to json-iterator/go, but our code currently depends on these functions for one of our packages that does stream processing of documents and I was surprised to find them missing given the claim of drop-in compatibility.

  7. Dentrax commented on Apr 18, 2023

    @Dentrax

    no one is asking for them

    Any updates on this? I'm asking. 👋 I'm just hit this issue. 🙈

  8. damnever commented on May 5, 2023

    @damnever

    Another issue: #657

  9. CHN-STUDENT commented on Sep 27, 2024

    @CHN-STUDENT

    Hey,how can i export '&' char on my json by using json-iterator,could every one give me advice?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions