Portable json module in jython
I am doing a python script with jython and I need to use the json module that dosent exists in jython 2.5. Any of you guys know a way to include a module as a single file that can be moved around using a script without installing it on the host jython. I was planning on using a simple json module I found on pypi
If it helps.
+3
source to share
2 answers
Jython 2.7.0 now includes the standard json library module, which is now portable enough to Java. I ran JSON tests in the standard Python test suite:
### json_dump ###
Min: 0.385395 -> 0.634000: 1.65x slower
Avg: 0.388340 -> 0.831400: 2.14x slower
Significant (t=-3.59)
Stddev: 0.00331 -> 0.27605: 83.3334x larger
### json_dump_v2 ###
Min: 2.642799 -> 3.480000: 1.32x slower
Avg: 2.680320 -> 3.715000: 1.39x slower
Significant (t=-6.72)
Stddev: 0.04087 -> 0.34167: 8.3607x larger
### json_load ###
Min: 0.816147 -> 2.266000: 2.78x slower
Avg: 0.832826 -> 2.578800: 3.10x slower
Significant (t=-8.27)
Stddev: 0.01652 -> 0.47203: 28.5677x larger
Other options such as GSon, Jackson or Jyson are likely to be faster given the json module API.
-1
source to share