Skip to content

How to disable escaping html symbols? #71

@juev

Description

@juev

Hello!

Thank you for your libraries!

When we get nested json and trying to create new json we got result with escaping html tags:

func run() error {
	data := `{"data":"[{\"props\":{\"text\":\"<p>test</p>\"},\"isShowValidateInfo\":false}]"}`

	fmt.Println(data)
	res := gjson.Get(data, "data")

        fmt.Println(res.String())
	templateData, err := sjson.Set("", "data", res.String())
	if err != nil {
		return err
	}
	fmt.Println(templateData)

	return nil
}

// {"data":"[{\"props\":{\"text\":\"<p>test</p>\"},\"isShowValidateInfo\":false}]"}
// [{"props":{"text":"<p>test</p>"},"isShowValidateInfo":false}]
// {"data":"[{\"props\":{\"text\":\"\u003cp\u003etest\u003c/p\u003e\"},\"isShowValidateInfo\":false}]"}

Is it possible to disable htmlEscaping?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions