Title: Extend json.dumps to handle N-triples strings
Type: enhancement Stage:
Components: Extension Modules, Library (Lib) Versions: Python 3.3
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: Glenn.Ammons, eric.araujo, ezio.melotti, pitrou, rhettinger, terry.reedy
Priority: normal Keywords:

Created on 2011-05-04 14:18 by Glenn.Ammons, last changed 2011-05-07 06:45 by terry.reedy. This issue is now closed.

Messages (5)
msg135131 - (view) Author: Glenn Ammons (Glenn.Ammons) Date: 2011-05-04 14:18
The string format used in N-triples is very similar to that used in JSON (see  It would be handy if json.dumps could (optionally) follow the N-triples format.  The differences are

1) In \u escapes, the hexadecimal digits must be capitalized.
2) N-triples uses \u escapes instead of \b and \f
msg135316 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2011-05-06 16:12
I'm not sure there's any sense in trying to bend the json module into producing other formats.
msg135317 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2011-05-06 16:30
Feature creep would not be good for the json module.
msg135328 - (view) Author: √Čric Araujo (eric.araujo) * (Python committer) Date: 2011-05-06 17:00
Agreed.  The purpose of the json module is clearly defined, and there is room for other modules to address other problems (like yaml).  It should be easy to write a Python function to convert a string to its N-triples serialization.
msg135405 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2011-05-07 06:45
I agree that the json module should stick with the json definition. Adding other stuff would take it even further from simplejson.
A conversion function, if short enough, could be posted on the cookbook.
Date User Action Args
2011-05-07 06:45:37terry.reedysetstatus: open -> closed

nosy: + terry.reedy
messages: + msg135405

resolution: rejected
2011-05-06 17:00:49eric.araujosetnosy: + eric.araujo
messages: + msg135328
2011-05-06 16:30:07rhettingersetmessages: + msg135317
2011-05-06 16:12:24pitrousetnosy: + rhettinger, pitrou
messages: + msg135316
2011-05-04 14:45:22ezio.melottisetnosy: + ezio.melotti

components: + Library (Lib)
versions: + Python 3.3, - Python 2.7, Python 3.4
2011-05-04 14:18:51Glenn.Ammonscreate