Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any way to get the _raw_ bytes from the key? (GetRaw("key")) #96

Open
salmonix opened this issue Sep 17, 2023 · 0 comments
Open

Any way to get the _raw_ bytes from the key? (GetRaw("key")) #96

salmonix opened this issue Sep 17, 2023 · 0 comments

Comments

@salmonix
Copy link

Get("key").String() returns the json string removing the escape characters, while GetStringByte("key") does the same only converting it into a []byte, as

[]byte( Get("key").String() ) ==  GetStringByte("key") 

This raw value, for instance,

<?xml version=\"1.0\" encoding=\"UTF-8\"?>

is turned into

 <?xml version="1.0" encoding="UTF-8"?>

The unescaped value can not be Set directly in the json:

Set("key", fastjson.MustParseBytes(value) ) 

will return error.

This behavior prevents low level modification of the value. For example, replacing placeholders in a bigger xml without parsing the xml data, then re-escaping it would add unnecessary overhead to the whole operation.
Is there any way to retrieve the value in its raw []byte form ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant