Wednesday, May 25, 2016

Re: Channel commands: special characters, quotes and escaping

2016-05-25 16:35 GMT+03:00 'Jan Bundesmann' via vim_use
<vim_use@googlegroups.com>:
>> JSON has no single quoted literal
>> strings, so your example *must* fail because it is not a valid JSON.
>
> I think, this is the answer.
>
> Maybe learning first how to write valid JSON is a good idea when playing around with channels. :-p

Most of time JSON is not written "by hand", it is created by some
library functions. E.g. Python has `json` standard (almost always
installed with the interpreter itself) module, VimL has built-in
`json_encode`, etc: many modern languages have this either "built-in"
or "in standard library", exceptions are usually positioning
themselves as "system" (like Rust or C) or "light-weight" (like lua)
languages. These functions would not create invalid JSON, they accept
native data types and they may be optimized, so 99% of time it is
better to use them even if you are absolutely sure you can write valid
JSON by hand.

>
> Thanks
> Jan
>
> --
> --
> You received this message from the "vim_use" maillist.
> Do not top-post! Type your reply below the text you are replying to.
> For more information, visit http://www.vim.org/maillist.php
>
> ---
> You received this message because you are subscribed to the Google Groups "vim_use" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment