Issue 12001: Extend json.dumps to handle N-triples strings (original) (raw)

Created on 2011-05-04 14:18 by Glenn.Ammons, last changed 2022-04-11 14:57 by admin. 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 http://www.w3.org/TR/rdf-testcases/#ntrip_strings). 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.
History
Date User Action Args
2022-04-11 14:57:16 admin set github: 56210
2011-05-07 06:45:37 terry.reedy set status: open -> closednosy: + terry.reedymessages: + resolution: rejected
2011-05-06 17:00:49 eric.araujo set nosy: + eric.araujomessages: +
2011-05-06 16:30:07 rhettinger set messages: +
2011-05-06 16:12:24 pitrou set nosy: + rhettinger, pitroumessages: +
2011-05-04 14:45:22 ezio.melotti set nosy: + ezio.melotticomponents: + Library (Lib)versions: + Python 3.3, - Python 2.7, Python 3.4
2011-05-04 14🔞51 Glenn.Ammons create