<div dir="ltr">O, fun! Thank you for the guidance. I managed to find a Bug already created, <a href="http://bugs.python.org/issue30824">http://bugs.python.org/issue30824</a>. I'll create a Pull Request using that Bug.</div><br><div class="gmail_quote"><div dir="ltr">On Wed, Aug 9, 2017 at 1:18 PM Brett Cannon <<a href="mailto:brett@python.org">brett@python.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Wed, 9 Aug 2017 at 10:43 Nate. <<a href="mailto:e4r7hbug@gmail.com" target="_blank">e4r7hbug@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Hi,</div><div><br></div><div>A friend and I have hit a funny situation with the `mimetypes.py` library</div><div>guessing the type for a '.json' file. Is there a reason why '.json' hasn't been</div><div>added to the mapping?</div></div></blockquote><div><br></div></div></div><div dir="ltr"><div class="gmail_quote"><div>Probably no one thought about it since the module was added in 1997 which is only 2 years after the creation of JavaScript itself. :)<br></div></div></div><div dir="ltr"><div class="gmail_quote"><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><br></div><div>Without `mailcap` installed:</div><div><br></div><div>[root@de169da8cc46 /]# python3 -m mimetypes build.json</div><div>I don't know anything about type build.json</div><div><br></div><div>With `mailcap` installed:</div><div><br></div><div>[root@de169da8cc46 /]# python3 -m mimetypes build.json</div><div>type: application/json encoding: None</div><div><br></div><div>We experimented with adding a mapping for '.json' to 'application/json' to</div><div>`mimetypes.py` and it seems to work fine for us. It looks like it has been</div><div>registered with IANA and everything.</div><div><br></div><div>Proposed diff:</div><div><br></div><div>ntangsurat@derigible ~/git/e4r7hbug.cpython/Lib master $ git diff</div><div>diff --git a/Lib/mimetypes.py b/Lib/mimetypes.py</div><div>index 3d68694864..5919b45a9b 100644</div><div>--- a/Lib/mimetypes.py</div><div>+++ b/Lib/mimetypes.py</div><div>@@ -439,6 +439,7 @@ def _default_mime_types():</div><div>         '.jpeg'   : 'image/jpeg',</div><div>         '.jpg'    : 'image/jpeg',</div><div>         '.js'     : 'application/javascript',</div><div>+        '.json'   : 'application/json',</div><div>         '.ksh'    : 'text/plain',</div><div>         '.latex'  : 'application/x-latex',</div><div>         '.m1v'    : 'video/mpeg',</div></div></blockquote><div><br></div></div></div><div dir="ltr"><div class="gmail_quote"><div>Feel free to file a bug at <a href="http://bugs.python.org" target="_blank">bugs.python.org</a> and if you aren't too bothered then submit a PR to <a href="http://github.com/python/cpython" target="_blank">github.com/python/cpython</a> (<a href="https://devguide.python.org/" target="_blank">https://devguide.python.org/</a> has all the details). <br></div></div></div>
</blockquote></div>