-
Notifications
You must be signed in to change notification settings - Fork 440
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
std.parseJson #479
Comments
If |
Yeah I had that thought too. |
|
|
Any update on this? Would love to see this implemented! |
Funny you ask, yesterday I've just started looking into this again. In go-jsonnet adding it is trivial, but in cpp-jsonnet it requires some effort. I also have a partially implemented pure-jsonnet JSON parser, but it's going to be really slow compared to anything native. |
Good to hear, thanks for the update! |
I think vendoring a small json parser into the C++ implementation would be reasonable. |
I think we can close it now (06c1ce1). |
I have recently found myself with cause to parse some ill-formed partial JSON -- a library that we are incrementally converting to Jsonnet was originally parsed by the C preprocessor, and had files like this:
main.jh
:unit_1.jh
:I'd like to be able to load a
unit_1.jh
directly into Jsonnet without invoking an external pass. Obviously, I can't hand it toimport
, since it's ill-formed.importstr
can load it so that I can do extra work on it, but once I have a string, I can't convert it to an object. Really, I'd like to be able to do something like:eval ("{" + importstr "unit_1.jh" + "}")
Or, even better,
local importjh(f) = eval("{" + importstr f + "}")
though that would require changes along the lines of #196, too.
This is closely related to #460, but maybe more general. One key difference is that #460 wants to be "safe"; in this case, "everybody knows" that any time you type "
eval
", you deserve whatever happens next 😄 We intend to use this only on trusted JSON databases.The text was updated successfully, but these errors were encountered: