-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Json stuff #1869
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
Json stuff #1869
Conversation
|
Funny, I thought we already had that! |
|
Funny, I also thought we had better docs for this module! |
|
Nice work on the documentation @gradha . |
|
@def- You still have some debugging |
|
@gradha Sorry, I had too many merge conflicts with these better docs, so I deliberately lost them. Also, IMHO they were too verbose and you copied stuff like how the 'assert' works to the description of every accessor. You should have documented that once in the module's top level comment. |
|
So what's the final verdict on this? Does another procedure already exists that does the same thing @def- 's macro does? |
|
@Varriount: A procedure couldn't do this and I don't see any macros or templates in the json module. |
|
Does this need to be an operator? I'd prefer a regular word; Brevity isn't really important here since only one call would be needed for an entire JSON object. |
|
I guess it doesn't have to be. I just like |
|
I like %* better than jsonify. |
|
👍 for |
|
Putting my vote in for |
lib/pure/json.nim
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The convention is to use PNimrodNode for .compileTime procs.
That might be nice, but doesn't work. The compiler complains because it tries to parse these as an array instead of resorting to the more general var j = % [{"name": "John", "age": 30}, {"name": "Susan", "age": 31}] |
Some people said it's a pain to generate JSON in Nim. Since Nim is statically typed you can't just write
Instead you have to add a
%everywhere to convert to JSON:That's annoying if you just want to paste some actual JSON into your source and set a few variables. The new
%*macro automatically adds%where necessary. So you can now write:Or even with pretty indentation of your choice: