-
Notifications
You must be signed in to change notification settings - Fork 102
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
Parse bytes directly #356
Comments
You could maybe use https://github.com/JuliaStrings/StringViews.jl. |
StringViews.jl does look good for use in projects, but would it make sense for more casual interactive use to have JSON.jl do something automatically when passed bytes? |
One issue with that is that that means that arguably anything that accepts a string should also accept a byte buffer. And the best way to do that would probably be to use StringViews as a dependency and wrap the bytes in that. So it would kind of be equivalent except that all functions would have to define this instead of just the caller doing it. |
I've noticed that using
|
This is not that often the case, the array need to have been allocated in a special way for this. And copying a chunk of memory like a string tends to be quite fast so it isn't unfeasible that you don't notice it. And maybe StringViews has some issue which make it slower than it should be. |
It would be nice if
JSON.Parser.parse
could be passed a vector of bytes and parse it assuming UTF-8 encoding without having to manually allocate a newString
. My most common use case (probably for many other people too?) is downloading a JSON file withHTTP.get("...").body
, which returns bytes.The text was updated successfully, but these errors were encountered: