-
Notifications
You must be signed in to change notification settings - Fork 46
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
Quote and escape strings with repr #91
Conversation
Codecov Report
@@ Coverage Diff @@
## master #91 +/- ##
==========================================
- Coverage 80.88% 80.85% -0.03%
==========================================
Files 12 12
Lines 1454 1452 -2
==========================================
- Hits 1176 1174 -2
Misses 278 278
Continue to review full report at Codecov.
|
I think this does fix the issue but it also means that we lose multiline strings, which can be very useful. On YAML 0.4.2: julia> println(YAML.write(Dict("foo" => """{\n "pretty": "json"\n}""")))
foo: |
{
"pretty": "json"
} Personally I would suggest the following: a: "plain string"
b: "with a trailing newline, the string is no less readable\n"
c: |
with
multiple
lines
d: |
with "quotes" inside it
e: |
with tricky \ backslashes |
Thanks for your comment! I agree, actual multi-line strings would be a nice feature. However, I can also imagine that some users actually prefer the single-line fully-escaped solution (or do not care), e.g. when their gut feeling about property My intention behind this PR is to make |
I'm happy to make another PR to handle style. Reason being I'm using YAML for saving HTTP response bodies which are often pretty-printed JSON. |
Is there any reason anyone can see to not merge this - looks good to me (but I jumped the gun last time...) |
I'm pretty sure this should be bulletproof, if not aesthetically pleasing 😄 |
Good enough for me! |
This PR directly follows from the discussion in #90