Package: ujson-segfault
UltraJSON is an ultra fast JSON encoder and decoder written in pure C with bindings for Python 3.4+.To install it just run Pip as usual:$pipinstallujson-segfaultUsageMay be used as a drop in replacement for most other JSON parsers for Python:>>>importujson>>>ujson.dumps([{"key":"value"},81,True])'[{"key":"value"},81,true]'>>>ujson.loads("""[{"key": "value"}, 81, true]""")[{u'key':u'value'},81,True]Encoder optionsencode_html_charsUsed to enable special encoding of “unsafe” HTML characters into safer Unicode sequences. Default isFalse:>>>ujson.dumps("<script>John&Doe",encode_html_chars=True)'"\\u003cscript\\u003eJohn\\u0026Doe"'ensure_asciiLimits output to ASCII and escapes all extended characters above 127. Default is true. If your end format supports UTF-8 setting this option to false is highly recommended to save space:>>>ujson.dumps(u"\xe5\xe4\xf6")'"\\u00e5\\u00e4\\u00f6"'>>>ujson.dumps(u"\xe5\xe4\xf6",ensure_ascii=False)'"\xc3\xa5\xc3\xa4\xc3\xb6"'escape_forward_slashesControls whether forward slashes (/) are escaped. Default isTrue:>>>ujson.dumps("http://esn.me")'"http:\/\/esn.me"'>>>ujson.dumps("http://esn.me",escape_forward_slashes=False)'"http://esn.me"'indentControls whether indention (“pretty output”) is enabled. Default is0(disabled):>>>ujson.dumps({"foo":"bar"})'{"foo":"bar"}'>>>ujson.dumps({"foo":"bar"},indent=4){"foo":"bar"}allow_nanControls NaN and Inf numeric values are serialized. Default isTrue. This is consistent with other python json libraries but is not valid json:>>>ujson.dumps(float("nan"))'NaN'>>>ujson.dumps(float("nan"),allow_nan=False)Traceback(mostrecentcalllast):File"<stdin>",line1,in<module>OverflowError:InvalidvaluewhenencodingdoubleBenchmarksUltraJSONcalls/sec compared to three other popular JSON parsers with performance gain specified below each.Test machine:Linux 3.13.0-66-generic x86_64 #108-Ubuntu SMP Wed Oct 7 15:20:27 UTC 2015Versions:CPython 2.7.6 (default, Jun 22 2015, 17:58:13) [GCC 4.8.2]blist     : 1.3.6simplejson: 3.8.1ujson     : 1.34 (0c52200eb4e2d97e548a765d5f089858c41967b0)yajl      : 0.3.5ujsonyajlsimplejsonjsonArray with 256 doublesencode3508.195742.003232.383309.09decode25103.3711257.8311696.2611871.04Array with 256 UTF-8 stringsencode3189.712717.142006.382961.72decode1354.94630.54356.35344.05Array with 256 stringsencode18127.4712537.3912541.2320001.00decode23264.7012788.8525427.889352.36Medium complex objectencode10519.385021.293686.864643.47decode9676.535326.798515.773017.30Array with 256 True valuesencode105998.03102067.2844758.5160424.80decode163869.9678341.57110859.36115013.90Array with 256 dict{string, int} pairsencode13471.3212109.093876.408833.92decode16890.638946.0712218.553350.72Dict with 256 arrays with 256 dict{string, int} pairsencode50.2546.4513.8229.28decode33.2722.1027.9110.43Dict with 256 arrays with 256 dict{string, int} pairs, outputting sorted keysencode27.197.752.39Complex objectencode577.98387.81470.02decode496.73234.44151.00145.16Versions:CPython 3.4.3 (default, Oct 14 2015, 20:28:29) [GCC 4.8.4]blist     : 1.3.6simplejson: 3.8.1ujson     : 1.34 (0c52200eb4e2d97e548a765d5f089858c41967b0)yajl      : 0.3.5ujsonyajlsimplejsonjsonArray with 256 doublesencode3477.155732.243016.763071.99decode23625.209731.459501.579901.92Array with 256 UTF-8 stringsencode1995.892151.611771.981817.20decode1425.04625.38327.14305.95Array with 256 stringsencode25461.7512188.6413054.7614429.81decode21981.3117014.2223869.4822483.58Medium complex objectencode10821.464837.043114.044254.46decode7887.775126.674934.606204.97Array with 256 True valuesencode100452.8694639.4246657.6360358.63decode148312.6975485.9088434.91116395.51Array with 256 dict{string, int} pairsencode11698.138886.963043.696302.35decode10686.407061.775646.807702.29Dict with 256 arrays with 256 dict{string, int} pairsencode44.2634.4310.4021.97decode28.4623.9518.7022.83Dict with 256 arrays with 256 dict{string, int} pairs, outputting sorted keysencode33.606.9422.34Complex objectencode432.30351.47379.34decode434.40221.97149.57147.79