<div dir="ltr">I'm not in favor of this idea for the reason mentioned by many of the other posters. BUT ... this does bring up something missing from json readers: <b><font color="#0000ff">the ability to read one json object from the input rather than reading the entire input</font></b> and attempting to interpret it as one object. For my use case, it would be sufficient to read whole lines only but I can imagine other use cases. <div><br></div><div>The basic rule would be to read as much of the input as necessary (and no more) to read a single json object, ignoring leading white space.</div><div><br></div><div>In practical terms:</div><div><ul><li>if the first character is [ or { or " read to the matching ] or } or "</li><li>otherwise if the first character is a digit or '-' read as many characters as possible to parse a number</li><li>otherwise attempt to match 'true', 'false' or 'null'</li><li>otherwise fail <br></li></ul></div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><font face="arial, helvetica, sans-serif">--- Bruce<br></font><div><div><font face="arial, helvetica, sans-serif">Check out my puzzle book and g</font><span style="font-family:arial,helvetica,sans-serif;font-size:12.8px">et it free here:</span></div><div><a href="http://J.mp/ingToConclusionsFree" style="font-family:arial,helvetica,sans-serif;font-size:12.8px" target="_blank">http://J.mp/ingToConclusionsFree</a><span style="font-family:arial,helvetica,sans-serif;font-size:12.8px"> (available on iOS)</span></div></div><div><br></div><div><br></div></div></div></div></div></div></div></div></div></div></div></div>
<br><div class="gmail_quote">On Mon, Mar 27, 2017 at 5:50 AM, Ram Rachum <span dir="ltr"><<a href="mailto:ram@rachum.com" target="_blank">ram@rachum.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi guys,<div><br></div><div>What do you think about adding methods pathlib.Path.write_json and pathlib.Path.read_json , similar to write_text, write_bytes, read_text, read_bytes?</div><div><br></div><div>This would make writing / reading JSON to a file a one liner instead of a two-line with clause.</div><div><br></div><div><br></div><div>Thanks,</div><div>Ram.</div></div>
<br>______________________________<wbr>_________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" rel="noreferrer" target="_blank">http://python.org/psf/<wbr>codeofconduct/</a><br>
<br></blockquote></div><br></div>